Skip to content

[DX] GAP-17: Auto-generated .mermaid files have invalid Mermaid syntax — diagrams fail to render #1505

@AlexBizon

Description

@AlexBizon

Summary

The .mermaid files generated by uipath init contain invalid Mermaid syntax. Node IDs use raw filename.py:lineNumber strings which contain . and : — both special characters in Mermaid's flowchart syntax. The diagrams fail to render in all standard Mermaid viewers.

Root Cause

graph_builder.py dumps node IDs as raw source location strings (e.g. vendor.py:52). In Mermaid flowchart syntax:

  • . is used as a subgraph qualifier
  • : is a separator in edge labels

The generated output is structurally invalid:

flowchart TB
  vendor.py:52(check_vendor_risk)
  vendor.py:110(_resolve_instance_url)
  vendor.py:52 --> vendor.py:110

A valid equivalent requires sanitized IDs and quoted labels:

flowchart TB
  vendor_py_52["check_vendor_risk"]
  vendor_py_110["_resolve_instance_url"]
  vendor_py_52 --> vendor_py_110

How to Reproduce

  1. Create a project with Python functions
  2. Run uipath init
  3. Open any generated .mermaid file in the Mermaid Live Editor (mermaid.live) or VS Code Mermaid extension
  4. The diagram fails to parse

Suggested Fix

In graph_builder.py, sanitize node IDs before writing:

def sanitize_node_id(source_location: str) -> str:
    # Replace special characters with underscores
    return re.sub(r'[.:]', '_', source_location)

# Generate:
# vendor_py_52["check_vendor_risk"]
# instead of:
# vendor.py:52(check_vendor_risk)

Alternatively, if these files are not rendered/consumed by any UiPath platform tooling, stop generating them entirely (see GAP-15).

Impact

  • Severity: Low (cosmetic/tooling)
  • Every generated .mermaid file is broken
  • If the platform renders these diagrams, they all fail silently

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions