← Back to editor

Mermaid error

A vertical bar inside a node label is edge syntax

Reproduced on Mermaid 11.17.2 · Updated

A vertical bar inside a node label is edge syntax in Mermaid. The exact parser message, why it happens, and corrected source that renders.

What Mermaid says

Parse error on line 2:
...owchart TD  A[Cost | USD] --> B[Next]
----------------------^
Expecting 'SQE', 'TAGEND', 'UNICODE_TEXT', 'TEXT', 'TAGSTART', got 'PIPE'

Why it happens

The vertical bar introduces an edge label. Inside an unquoted node label it ends the label and the parser expects an edge instead.

The source that fails

flowchart TD
  A[Cost | USD] --> B[Next]

How to fix it

Quote the label, or replace the bar with a word such as “or”.

flowchart TD
  A["Cost | USD"] --> B[Next]

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.