← Back to editor

Mermaid error

A class relationship needs a full line

Reproduced on Mermaid 11.17.2 · Updated

A class relationship needs a full line in Mermaid. The exact parser message, why it happens, and corrected source that renders.

What Mermaid says

Parse error on line 2:
...sDiagram  Animal <|- Dog
----------------------^
Expecting 'LINE', 'DOTTED_LINE', got 'MINUS'

Why it happens

The inheritance marker must be followed by two dashes for a solid line or two dots for a dotted one. A single dash is not a line token.

The source that fails

classDiagram
  Animal <|- Dog

How to fix it

Write the relationship with a complete line.

classDiagram
  Animal <|-- Dog

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.