scrml.dev v0.7.1
Reference › Errors

E-MATCH-EFFECT-FORBIDDEN

effect= attribute used on a state-child inside a <match> block.

Error Compile-time SPEC §18.0.2 (normative)

What it means

The effect= attribute is the per-rule inline form of a transition effect — sibling to <onTransition>. Effects presuppose that a transition occurs. Block-form match is rules-inert: nothing transitions inside it (the matched-on value either is or isn't a given variant). So effect= is structurally meaningless on a match arm. The compiler forbids it as an error, not a lint — its presence indicates the wrong primitive.

Minimal reproducer

type Phase:enum = { Idle, Loading, Done }

<match for=Phase>
  <Idle></>
  <Loading effect=${ analytics.track("load") }></>
  //       ^^^^^^^
  //       E-MATCH-EFFECT-FORBIDDEN: effect= on match arm.
  //       Promote to <engine> to activate effects.
  <Done></>
</match>

How to fix

Promote to <engine>. Same case-analysis shape; effect= and <onTransition> become legal:

<engine for=Phase initial=.Idle>
  <Idle    rule=.Loading />
  <Loading rule=.Done effect=${ analytics.track("load") } />
  <Done    rule=.Idle    />
</engine>

effect= vs <onTransition>

Inside an engine, effect= is the shorter form for single-target rules. Multi-target rules fire E-ENGINE-EFFECT-AMBIGUOUS because the destination is ambiguous — use <onTransition> instead, which filters by from / to / once / if.

Related

Specification

Normative text: SPEC §18.0.2 (match attribute legality), §51.0.H (effect= in engine context), §34 catalog row. Spec lives at compiler/SPEC.md .