Error reference / stateDiagram-v2

State diagram parse error: got 'INVALID'

A transition between two states uses a single dash instead of stateDiagram's arrow (-->), the same class of mistake as the flowchart single-dash trap.

Parse error on line 3:
...> State1    State1 - State2    State2
----------------------^
Expecting 'SPACE', 'NL', 'DESCR', '-->', ... got 'INVALID'

Why this happens

stateDiagram-v2 transitions require the two-dash arrow, State1 --> State2, same as flowcharts. A single dash isn't a recognized transition token, so the parser stops right after it.

This usually happens when copying a relationship from a different diagram type, or typing quickly and dropping a character.

How to fix it

Use --> between every pair of states, including transitions into and out of [*] (the start/end marker).

Broken

Fails to parse

Rendering preview...
stateDiagram-v2
    [*] --> State1
    State1 - State2
    State2 --> [*]

Fixed

Renders correctly

Rendering preview...
stateDiagram-v2
    [*] --> State1
    State1 --> State2
    State2 --> [*]
Open fixed version in studio

More errors