Skip to content
State machine (FSM) templates

Teaching Case — An Arrow to a State That Does Not Exist

One character changed: the transition out of `Paid` goes to `Shipd`. Every tool that draws what it is handed omits that arrow entirely — the renderer this engine replaces did `if (!a || !b) continue;` — so the figure showed a complete machine with one fewer edge, and nothing anywhere said an edge was missing. Here the arrow is drawn to a dashed box carrying the name that does not exist, and the reachability checks report a GAP rather than blaming the states the missing edge would have reached.

Template previewState machine (FSM)
Order lifecycle5 states · 4 transitions · 4 eventscheckoutpaymentdispatchdeliveredCartPendingPaidShippedDeliveredShipdnever declared1 statement in this machine cannot be true of any run.ERRORThe transition on line 13 names `Shipd`, which is never declared. The renderer this replaces DROPPED such an arrow from the drawing with no diagnostic, so a mistyped target produced acomplete-looking machine missing an edge nobody could see was missing.GAPReachability is UNCHECKED: one transition names a state that does not exist (line 13), so the machine this document describes is not the machine drawn. Correct it and every answer belowchanges.

Make it your own.

title "Order lifecycle"

state Cart
state Pending
state Paid
state Shipped
state Delivered final

initial Cart

transition Cart    -> Pending   on "checkout"
transition Pending -> Paid      on "payment"
transition Paid    -> Shipd     on "dispatch"
transition Shipped -> Delivered on "delivered"