Mermaid says "No diagram type detected": what it means and how to fix it

"No diagram type detected matching given configuration" means the first line does not name a diagram type. Four usual causes: you pasted a text outline, the first line is missing, it is misspelled, or the code is in another diagram language. Each has a fix.

About 3 minUpdated 2026-11-11

The short answer

Mermaid reads the first line to decide what to draw: flowchart TD, mindmap, sequenceDiagram, gantt and so on. When the first line is none of those keywords you get No diagram type detected matching given configuration for text. The editor shows this as "No diagram code found".

Cause 1: it is an outline, not code

Ask an AI assistant for a mind map and it sometimes returns an indented or numbered outline:

Project plan
  Research
  Design
  Build and test

That is not Mermaid code yet. Add a mindmap line on top and indent the rest one more level:

mindmap
  Project plan
    Research
    Design
    Build and test

Edit the text, switch themes and download PNG, Word or PowerPoint from there.

When the editor sees an indented, numbered or Markdown-heading outline it offers "Turn into a mind map" directly.

Cause 2: the first line is missing

Only the second half of the code was copied, or the assistant left the first line out:

A[Start] --> B{Approved?}
B -- Yes --> C[Done]

Add flowchart TD and it renders:

flowchart TD
    A[Start] --> B{Approved?}
    B -- Yes --> C[Done]

Edit the text, switch themes and download PNG, Word or PowerPoint from there.

Cause 3: a typo or an alias on the first line

  • flowchart written as flowchat or flow chart; mindmap written as mind map.
  • A radar chart needs radar-beta, not radar; a fishbone diagram needs ishikawa-beta, not fishbone.
  • An invisible character before the first line, or flowchart-TD with a hyphen where a space belongs.

The editor recognizes these and shows a one-click "Fix it".

Cause 4: another diagram language

digraph G { … } is Graphviz DOT and @startuml … @enduml is PlantUML. Neither is interchangeable with Mermaid. Send the code to an AI assistant, ask it to rewrite it as Mermaid, and paste the whole reply back.

You only have a description

If what you pasted is a paragraph, a web page or a description of a picture, it really is not code. Click "Draw it with AI" in the editor and the text becomes a diagram, or follow Only text, no code to ask an assistant yourself. Other errors are covered in Common errors.

More guides

All guides