← Back to editor

Mermaid error

Merging a branch that was never created

Reproduced on Mermaid 11.17.2 · Updated

Merging a branch that was never created in Mermaid. The exact parser message, why it happens, and corrected source that renders.

What Mermaid says

Incorrect usage of "merge". Branch to be merged (nothere) does not exist

Why it happens

A merge can only target a branch that exists at that point in the graph. Naming one that was never created stops the diagram with a message about the merge.

The source that fails

gitGraph
  commit
  merge nothere

How to fix it

Create the branch before merging it, and check the spelling.

gitGraph
  commit id: "init"
  branch feature
  checkout feature
  commit id: "work"
  checkout main
  merge feature id: "merge"

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.