Yield Star In Event Callback Error
Trace a markup event whose entire attribute value is a callback containing yield work.What this error means and what can trigger it
YieldStarInEventCallbackError means an event-like attribute contains SER work, although the entire attribute expression is already an arrow or function expression. Examples include onclick={() => yield* Save()} and oninput={function (event) { yield* Validate(event); }}.
By this stage, markup classification has already established that the attribute follows Svelte's event conventions. The error concerns the expression's outer AST shape, not a textual search for =>: SER parses the expression as an initializer and checks whether that initializer is an arrow or function expression.
Exactly where it triggers
const expr_text = candidate.expr_text;
if (is_callback_function_expression(expr_text)) {
throw new YieldStarInEventCallbackError(candidate.filename, expr_text);
}This happens during markup emission, before SER generates the actual event callback. It is a synchronous preprocessing exception. For reference, the class itself is declared at modules/svelte-effect-runtime/src/errors.ts L272 @ C14.
The accepted boundary form leaves callback creation to SER:
<button onclick={yield* Save()}>Save</button>Why this is the case
SER generates an event callback whose body submits generator work to the component dispatcher. A source arrow function creates another JavaScript function boundary around the yield*. Ordinary arrows and non-generator functions cannot own generator delegation syntax, and preserving the wrapper would keep the work outside SER's generated generator.
Removing the wrapper also gives the dispatcher ownership of interruption and component teardown for that event execution. SER can generate that lifecycle only when the effect expression sits directly at the attribute boundary.