draw mermaid wrong when node name is Chinese text #951

Closed
opened 2026-02-20 17:42:29 -05:00 by yindo · 1 comment
Owner

Originally created by @Ovi3 on GitHub (Aug 28, 2025).

Originally assigned to: @casparb on GitHub.

Checked other resources

  • This is a bug, not a usage question. For questions, please use the LangChain Forum (https://forum.langchain.com/).
  • I added a clear and detailed title that summarizes the issue.
  • I read what a minimal reproducible example is (https://stackoverflow.com/help/minimal-reproducible-example).
  • I included a self-contained, minimal example that demonstrates the issue INCLUDING all the relevant imports. The code run AS IS to reproduce the issue.

Example Code

from langgraph.graph import MessagesState, StateGraph

def node_1(state):
    return {"a": 1}

def node_2(state):
    return {"b": 2}

# 添加节点
builder = StateGraph(MessagesState)
builder.add_node("开始", node_1)
builder.add_node("结束", node_2)

# 设置流程
builder.set_entry_point("开始")
builder.add_edge("开始", "结束")
builder.set_finish_point("结束")

# 编译图
graph = builder.compile()

print(graph.get_graph().draw_mermaid())

Error Message and Stack Trace (if applicable)


Description

When node names are Chinese text and Chinese text length is the same, mermaid image is wrong:

Image

the reason I saw is: It replace Chinese text to "__" (one Chinese char, one _ symbol)

System Info

langgraph==0.6.6

Originally created by @Ovi3 on GitHub (Aug 28, 2025). Originally assigned to: @casparb on GitHub. ### Checked other resources - [x] This is a bug, not a usage question. For questions, please use the LangChain Forum (https://forum.langchain.com/). - [x] I added a clear and detailed title that summarizes the issue. - [x] I read what a minimal reproducible example is (https://stackoverflow.com/help/minimal-reproducible-example). - [x] I included a self-contained, minimal example that demonstrates the issue INCLUDING all the relevant imports. The code run AS IS to reproduce the issue. ### Example Code ```python from langgraph.graph import MessagesState, StateGraph def node_1(state): return {"a": 1} def node_2(state): return {"b": 2} # 添加节点 builder = StateGraph(MessagesState) builder.add_node("开始", node_1) builder.add_node("结束", node_2) # 设置流程 builder.set_entry_point("开始") builder.add_edge("开始", "结束") builder.set_finish_point("结束") # 编译图 graph = builder.compile() print(graph.get_graph().draw_mermaid()) ``` ### Error Message and Stack Trace (if applicable) ```shell ``` ### Description When node names are Chinese text and Chinese text length is the same, mermaid image is wrong: <img width="1474" height="828" alt="Image" src="https://github.com/user-attachments/assets/acadbd7e-49fb-4655-a8bc-74278a218898" /> the reason I saw is: It replace Chinese text to "__" (one Chinese char, one _ symbol) ### System Info langgraph==0.6.6
yindo added the bugpending labels 2026-02-20 17:42:29 -05:00
yindo closed this issue 2026-02-20 17:42:29 -05:00
Author
Owner

@casparb commented on GitHub (Sep 11, 2025):

Hi @Ovi3, this was fixed in langchain-ai/langchain#32857. Thank you for flagging the issue!

@casparb commented on GitHub (Sep 11, 2025): Hi @Ovi3, this was fixed in langchain-ai/langchain#32857. Thank you for flagging the issue!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraph#951