← Back to editor

Mermaid error

Using end as a node name breaks a flowchart

Reproduced on Mermaid 11.17.2 · Updated

Using end as a node name breaks a flowchart in Mermaid. The exact parser message, why it happens, and corrected source that renders.

What Mermaid says

Parse error on line 2:
...t TD  A[Start] --> end
----------------------^
Expecting 'AMP', 'COLON', 'PIPE', 'TESTSTR', 'DOWN', 'DEFAULT', 'NUM', 'COMMA', 'NODE_STRING', 'BRKT', 'MINUS', 'MULT', 'UNICODE_TEXT', got 'end'

Why it happens

A bare lowercase end is the token that closes a subgraph. Used as a node identifier it closes a block that was never opened.

The source that fails

flowchart TD
  A[Start] --> end

How to fix it

Rename the identifier. The visible label can still read End, because the label and the identifier are separate.

flowchart TD
  A[Start] --> endNode["End"]

Next 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.