Mermaid error
A subgraph without end swallows the rest of the diagram
Reproduced on Mermaid 11.17.2 · Updated
A subgraph without end swallows the rest of the diagram in Mermaid. The exact parser message, why it happens, and corrected source that renders.
What Mermaid says
Parse error on line 5:
... A --> B C --> D
---------------------^
Expecting 'SEMI', 'NEWLINE', 'SPACE', 'EOF', 'subgraph', 'end', 'acc_title', 'acc_descr', 'acc_descr_multiline_value', 'AMP', 'COLON', 'STYLE', 'LINKSTYLE', 'CLASSDEF', 'CLASS', 'CLICK', 'DOWN', 'DEFAULT', 'NUM', 'COMMA', 'NODE_STRING', 'BRKT', 'MINUS', 'MULT', 'UNICODE_TEXT', 'direction_tb', 'direction_bt', 'direction_rl', 'direction_lr', 'direction_td', got '1'Why it happens
A subgraph block stays open until an end line closes it. Without that line the later statements are read inside the group and the diagram fails at the last line.
The source that fails
flowchart TD
subgraph Team
A --> B
C --> DHow to fix it
Close each subgraph with its own end line.
flowchart TD
subgraph Team
A --> B
end
C --> DNext 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.