Skip to content

State diagram: syntax errors in the state keyword are not checked properly. #7091

Closed

Description

@jonathanpoelen

Description

If there are multiple transitions between state and {, only the last one is used rather than returning an error.

Steps to reproduce

stateDiagram-v2
state only the last word is taken into account {
    X
}

Screenshots

Image

Code Sample


Setup

  • Mermaid version: 11.12.0
  • Browser and Version: Firefox 143.0.3

Suggested Solutions

No response

Additional Context

No response

Activity

  1. added
    Type: Bug / Error
    Status: Triage
    on Oct 19, 2025
  2. added
    Status: Approved
    and removed
    Status: Triage
    on Feb 27, 2026
  3. knsv commented on Feb 27, 2026

    @knsv
    Collaborator

    [sisyphus-bot] Nice find, @jonathanpoelen. The parser should reject invalid syntax between state and { rather than silently using only the last word. Approved as a parser bug.

  4. PinguinsRule commented on Mar 5, 2026

    @PinguinsRule
    Contributor

    Good evening, I would like to work on this bug for a university project if possible.

  5. added a commit that references this issue on Jun 4, 2026
    0c00846
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: ApprovedType: Bug / Error

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions