Mermaid error
Two diagram type declarations in one block
Reproduced on Mermaid 11.17.2 · Updated
Two diagram type declarations in one block in Mermaid. The exact parser message, why it happens, and corrected source that renders.
What Mermaid says
Parse error on line 3:
...wchart TD A --> Bgraph LR 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 'GRAPH'Why it happens
Two answers were pasted together, so a second flowchart or graph line appears in the middle. The parser reads it as part of the previous statement.
The source that fails
flowchart TD
A --> B
graph LR
C --> DHow to fix it
Keep one declaration and merge the statements beneath it.
flowchart TD
A --> B
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.