Reference › Errors
E-TIMER-NAME-DUPLICATE
Two <onTimeout> elements in one state-child share a name=.
What it means
Timer names are scope-local to the state-child body and must be unique within it, because name= is what cancelTimer("…") targets. Two timers with one name make the cancel call ambiguous — it could plausibly cancel either or both — so the collision is rejected at the declaration.
Minimal reproducer
This is the exact source compiled against the linked compiler and verified to produce E-TIMER-NAME-DUPLICATE.
<program title="p">
type Phase:enum = { Idle, Busy }
<engine for=Phase initial=.Idle>
<Idle rule=(.Busy)>
<onTimeout name="retry" after=1000ms to=.Busy/>
<onTimeout name="retry" after=2000ms to=.Busy/>
idle
</>
<Busy rule=(.Idle)>busy</>
</>
</>
How to fix
-
Rename one of the timers.
Distinct names make every
cancelTimer()call unambiguous. -
Drop
name=from the one you never cancel. An unnamed timer is index-keyed and uncancellable, which is fine when nothing cancels it.
Related
Specification
Normative text: §51.0.M, §19.13, §34. Spec lives at compiler/SPEC.md .