Mermaid error
A state transition needs a full arrow
Reproduced on Mermaid 11.17.2 · Updated
A state transition needs a full arrow in Mermaid. The exact parser message, why it happens, and corrected source that renders.
What Mermaid says
Parse error on line 2:
...ateDiagram-v2 [*] -> Active
----------------------^
Expecting 'SPACE', 'NL', 'DESCR', '-->', 'HIDE_EMPTY', 'scale', 'COMPOSIT_STATE', 'STRUCT_STOP', 'STATE_DESCR', 'ID', 'FORK', 'JOIN', 'CHOICE', 'CONCURRENT', 'note', 'acc_title', 'acc_descr', 'acc_descr_multiline_value', 'CLICK', 'STRING', 'HREF', 'classDef', 'style', 'class', 'direction_tb', 'direction_bt', 'direction_rl', 'direction_lr', 'EDGE_STATE', 'STYLE_SEPARATOR', got 'INVALID'Why it happens
State transitions use the same two-dash arrow as flowcharts. A single dash is not recognised.
The source that fails
stateDiagram-v2
[*] -> ActiveHow to fix it
Write the transition with two dashes.
stateDiagram-v2
[*] --> ActiveNext steps
Paste your own version into the Mermaid repair tool, which applies this correction and fourteen others and shows every change. The related page covers the surrounding syntax, and the error dictionary lists every message.