Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reverse arrows <-- not supported in flowchart #6402

Open
nourhenta opened this issue Mar 22, 2025 · 1 comment
Open

Reverse arrows <-- not supported in flowchart #6402

nourhenta opened this issue Mar 22, 2025 · 1 comment
Labels
Status: Triage Needs to be verified, categorized, etc Type: Bug / Error Something isn't working or is incorrect

Comments

@nourhenta
Copy link

Description

Using a reverse arrow (<--) in a Mermaid flowchart diagram leads to a cryptic syntax error. Many users may naturally assume B <-- C is valid, expecting it to behave like C --> B, especially since reverse arrows are supported in other graphing tools.

Instead of a helpful explanation, Mermaid throws the following error:

Expecting 'LINK', 'UNICODE_TEXT', 'EDGE_TEXT', got '1'

This behavior is confusing and not well-documented. Either the syntax should be supported, or Mermaid should provide a more descriptive error message.

Steps to reproduce

  1. Go to https://mermaid.live/
  2. Paste the following code in the editor:
flowchart TD
  A --> B
  B <-- C
  1. Notice the syntax error thrown:
    Expecting 'LINK', 'UNICODE_TEXT', 'EDGE_TEXT', got '1'

Screenshots

Image

Code Sample


Setup

  • Mermaid Version: v11.5.0 (tested on Mermaid Live Editor)
  • Browser: Chrome v122
  • Platform: Windows 11

Suggested Solutions

  • Add support for B <-- C syntax and internally convert it to C --> B.

  • Improve error messaging for unsupported arrow syntax.
    Instead of a cryptic parser error, show:
    "Reverse arrows (<--) are not currently supported. Try writing C --> B instead."

Additional Context

No response

@nourhenta nourhenta added Status: Triage Needs to be verified, categorized, etc Type: Bug / Error Something isn't working or is incorrect labels Mar 22, 2025
@BambioGaming
Copy link

I agree. The error message is "cryptic" because it speaks in parser language. When the parser reads B <-- C, it gets confused:

  • It sees B, then expects a valid arrow direction like -->, ---, etc.
  • Instead, it encounters <--, which doesn't match any valid link syntax.
  • Then it sees the 1st character of the next token (likely the node name C, or number 1 in another context), and throws an error because it was expecting a LINK.

That’s why it says:
Expecting 'LINK', 'UNICODE_TEXT', 'EDGE_TEXT', got '1'

It would be much clearer if it said something like:
Unsupported arrow '<--'. Mermaid only supports arrows like '-->', '---', etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Triage Needs to be verified, categorized, etc Type: Bug / Error Something isn't working or is incorrect
Projects
None yet
Development

No branches or pull requests

2 participants