Untitled conversation
- User
flowchart TD subgraph "Internal Workflow for 'ask_llm_for_analysis' Tool" A(Start<br/>Input: query, context) --> B{Generate<br/>Structured Prompt}; B -- "Prompt includes required<br/>JSON output schema" --> C[Execute LLM Call<br/>(e.g., Gemini API)]; C --> D{Parse & Validate<br/>LLM Response}; D -- "Is output valid JSON<br/>& matches schema?" --> |✅ Yes| G[Return Structured Data<br/>(e.g., a validated JSON object)]; D -- "❌ No" --> E{Retry/Self-Correct}; E -- "Re-prompt LLM with error<br/>and request corrected format" --> C; E -- "Max retries reached" --> F[Return Error]; G --> H(End); F --> H; endError: Error: Parse error on line 4: ...xecute LLM Call<br/>(e.g., Gemini API)]; -----------------------^ Expecting 'SQE', 'DOUBLECIRCLEEND', 'PE', '-)', 'STADIUMEND', 'SUBROUTINEEND', 'PIPE', 'CYLINDEREND', 'DIAMOND_STOP', 'TAGEND', 'TRAPEND', 'INVTRAPEND', 'UNICODE_TEXT', 'TEXT', 'TAGSTART', got 'PS' Assistant
The error you're encountering comes from Mermaid's parser, which doesn't recognize certain HTML-like syntax in node labels when it's expecting specific Mermaid syntax tokens. In your case, the issue is with the
<br/>tag inside the node label:C[Execute LLM Call<br/>(e.g., Gemini API)];Problem:
Mermaid does not support HTML tags like
<br/>by default in all contexts or environments — especially if you're using an older version or a strict parser.
✅ Solution 1: Use
\nfor Line Breaks (Recommended)Replace
<br/>with\nto insert a newline character in the label:flowchart TD subgraph "Internal Workflow for 'ask_llm_for_analysis' Tool" A(Start\nInput: query, context) --> B{Generate\nStructured Prompt}; B -- "Prompt includes required\nJSON output schema" --> C[Execute LLM Call\n(e.g., Gemini API)]; C --> D{Parse & Validate\nLLM Response}; D -- "Is output valid JSON\n& matches schema?" --> |✅ Yes| G[Return Structured Data\n(e.g., a validated JSON object)]; D -- "❌ No" --> E{Retry/Self-Correct}; E -- "Re-prompt LLM with error\nand request corrected format" --> C; E -- "Max retries reached" --> F[Return Error]; G --> H(End); F --> H; endThis should work across most Mermaid versions and renderers.
✅ Solution 2: Use HTML in Labels (Advanced, if supported)
If your environment supports HTML in Mermaid, you can use
::<br />::syntax or wrap the text in HTML explicitly:C[<div>Execute LLM Call<br />(e.g., Gemini API)</div>]But again, this depends on the renderer supporting HTML in Mermaid diagrams.
✅ Bonus Tip: Clean Up Arrows
Ensure that arrow labels are also clean and quoted properly:
D -- "❌ No" --> E E -- "Re-prompt..." --> CAvoid extra formatting unless necessary.
Let me know if you'd like help rendering this as a working diagram or converting it into another format like PlantUML!
- User
flowchart TD subgraph "Internal Workflow for 'ask_llm_for_analysis' Tool" A(Start<br/>Input: query, context) --> B{Generate<br/>Structured Prompt} B -- "Prompt includes required<br/>JSON output schema" --> C["Execute LLM Call<br/>(e.g., Gemini API)"] C --> D{Parse & Validate<br/>LLM Response} D -- "Is output valid JSON<br/>& matches schema?" --> |✅ Yes| G["Return Structured Data<br/>(e.g., a validated JSON object)"] D -- "❌ No" --> E{Retry/Self-Correct} E -- "Re-prompt LLM with error<br/>and request corrected format" --> C E -- "Max retries reached" --> F[Return Error] G --> H(End) F --> H endError: Error: Parse error on line 6: ...atches schema?" --> |✅ Yes| G["Return St -----------------------^ Expecting 'AMP', 'COLON', 'DOWN', 'DEFAULT', 'NUM', 'COMMA', 'NODE_STRING', 'BRKT', 'MINUS', 'MULT', 'UNICODE_TEXT', got 'PIPE' Sample Diagrams Assistant
The error you're seeing:
Expecting 'AMP', 'COLON', 'DOWN', 'DEFAULT', 'NUM', 'COMMA', 'NODE_STRING', 'BRKT', 'MINUS', 'MULT', 'UNICODE_TEXT', got 'PIPE'...is caused by the use of the
|✅ Yes|label in your Mermaid flowchart.❌ Problem:
Mermaid does not support the
|...|syntax for arrow labels in the way you're using it. That syntax is not valid Mermaid for labeling edges — even though you might have seen it used in some examples or tools (like Mermaid Live Editor with experimental features enabled).The pipe characters (
|) are confusing the parser.
✅ Solution: Use Quoted Labels Instead
Replace:
D -- "Is output valid JSON<br/>& matches schema?" --> |✅ Yes| G["Return Structured Data<br/>(e.g., a validated JSON object)"]With:
D -- "✅ Yes: Output valid JSON & matches schema" --> GAnd optionally, if you want to keep the "no" branch readable:
D -- "❌ No: Invalid or mismatched schema" --> E
✅ Updated Working Version
Here's your corrected diagram:
flowchart TD subgraph "Internal Workflow for 'ask_llm_for_analysis' Tool" A(Start<br/>Input: query, context) --> B{Generate<br/>Structured Prompt} B -- "Prompt includes required<br/>JSON output schema" --> C["Execute LLM Call<br/>(e.g., Gemini API)"] C --> D{Parse & Validate<br/>LLM Response} D -- "✅ Yes: Valid JSON & matches schema" --> G["Return Structured Data<br/>(e.g., a validated JSON object)"] D -- "❌ No: Invalid or mismatched schema" --> E{Retry/Self-Correct} E -- "Re-prompt LLM with error<br/>and request corrected format" --> C E -- "Max retries reached" --> F[Return Error] G --> H(End) F --> H end
🔍 Additional Notes:
- Use
<br/>only if your environment supports HTML-like syntax in Mermaid (many do, including Mermaid Live Editor and VSCode extensions). - Avoid special syntax like
|label|unless you're using a version or fork of Mermaid that explicitly supports it. - Always wrap labels containing special characters (like parentheses or quotes) in double quotes.
Let me know if you'd like to generate a PNG or SVG version of this diagram, or convert it to another format like PlantUML or Graphviz!
- Use
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.