← Back to editor

Mermaid error

An entity relationship needs a label

Reproduced on Mermaid 11.17.2 · Updated

An entity relationship needs a label in Mermaid. The exact parser message, why it happens, and corrected source that renders.

What Mermaid says

Parse error on line 2:
...USTOMER ||--o{ ORDER
-----------------------^
Expecting 'COLON', 'STYLE_SEPARATOR', got 'NEWLINE'

Why it happens

The relationship statement expects a colon and a name after the two entities. Without it the line ends where a colon was expected.

The source that fails

erDiagram
  CUSTOMER ||--o{ ORDER

How to fix it

Name the relationship, and use the cardinality markers on both sides.

erDiagram
  CUSTOMER ||--o{ ORDER : places

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.