Langgraph throws error on cycle #214

Closed
opened 2026-02-15 17:17:26 -05:00 by yindo · 4 comments
Owner

Originally created by @hassaans on GitHub (Mar 26, 2025).

We're using cycles to implement a RAG in langgraph. A recent update was a breaking change for us as now it doesn't let us recursively call a node:

Command send tree contains a cycle

Error: Command send tree contains a cycle
    at _convertCommandSendTree (/deps/langgraph-assistant-chat/node_modules/@langchain/langgraph/src/constants.ts:421:9)
    at <anonymous> (/deps/langgraph-assistant-chat/node_modules/@langchain/langgraph/src/constants.ts:437:2)
    at Array.map (<anonymous>)
    at _convertCommandSendTree (/deps/langgraph-assistant-chat/node_modules/@langchain/langgraph/src/constants.ts:437:2)
    at <anonymous> (/deps/langgraph-assistant-chat/node_modules/@langchain/langgraph/src/constants.ts:426:32)
    at Array.map (<anonymous>)
    at _convertCommandSendTree (/deps/langgraph-assistant-chat/node_modules/@langchain/langgraph/src/constants.ts:426:14)
    at <anonymous> (/deps/langgraph-assistant-chat/node_modules/@langchain/langgraph/src/constants.ts:437:2)
    at Array.map (<anonymous>)
    at _convertCommandSendTree (/deps/langgraph-assistant-chat/node_modules/@langchain/langgraph/src/constants.ts:437:2)
Image

I believe we should let users create cycles. But if this is not the intended way to implement this, kindly guide on how we can implement this on the current version

Originally created by @hassaans on GitHub (Mar 26, 2025). We're using cycles to implement a RAG in langgraph. A recent update was a breaking change for us as now it doesn't let us recursively call a node: ``` Command send tree contains a cycle Error: Command send tree contains a cycle at _convertCommandSendTree (/deps/langgraph-assistant-chat/node_modules/@langchain/langgraph/src/constants.ts:421:9) at <anonymous> (/deps/langgraph-assistant-chat/node_modules/@langchain/langgraph/src/constants.ts:437:2) at Array.map (<anonymous>) at _convertCommandSendTree (/deps/langgraph-assistant-chat/node_modules/@langchain/langgraph/src/constants.ts:437:2) at <anonymous> (/deps/langgraph-assistant-chat/node_modules/@langchain/langgraph/src/constants.ts:426:32) at Array.map (<anonymous>) at _convertCommandSendTree (/deps/langgraph-assistant-chat/node_modules/@langchain/langgraph/src/constants.ts:426:14) at <anonymous> (/deps/langgraph-assistant-chat/node_modules/@langchain/langgraph/src/constants.ts:437:2) at Array.map (<anonymous>) at _convertCommandSendTree (/deps/langgraph-assistant-chat/node_modules/@langchain/langgraph/src/constants.ts:437:2) ``` <img width="394" alt="Image" src="https://github.com/user-attachments/assets/aaba4bd1-675f-4c51-ad06-2ceaf21fc7f4" /> I believe we should let users create cycles. But if this is not the intended way to implement this, kindly guide on how we can implement this on the current version
yindo closed this issue 2026-02-15 17:17:26 -05:00
Author
Owner

@hassaans commented on GitHub (Mar 26, 2025):

This is the commit that introduced this breaking change: https://github.com/langchain-ai/langgraphjs/commit/891ebc3dcbe7d88360c287239cb23777e202b365

@hassaans commented on GitHub (Mar 26, 2025): This is the commit that introduced this breaking change: https://github.com/langchain-ai/langgraphjs/commit/891ebc3dcbe7d88360c287239cb23777e202b365
Author
Owner

@hassaans commented on GitHub (Mar 26, 2025):

Moving back to v0.2.57 seems to have fixed this issue

@hassaans commented on GitHub (Mar 26, 2025): Moving back to v0.2.57 seems to have fixed this issue
Author
Owner

@benjamincburns commented on GitHub (Mar 26, 2025):

Thanks for reporting this, @hassaans! This is due to a bug that I introduced accidentally. I didn't realize that it was valid for Command and/or Send objects to contain reference cycles. I've just PR'd a fix in #1046. I'll get it merged and released within the hour!

@benjamincburns commented on GitHub (Mar 26, 2025): Thanks for reporting this, @hassaans! This is due to a bug that I introduced accidentally. I didn't realize that it was valid for Command and/or Send objects to contain reference cycles. I've just PR'd a fix in #1046. I'll get it merged and released within the hour!
Author
Owner

@benjamincburns commented on GitHub (Mar 26, 2025):

I hit a small snag that delayed me slighty (shoutout to @dqbd for helping improve the quality of the final fix!), but this is now released in @langchain/langgraph@0.2.60.

Once again - sorry for wasting your time with this bug @hassaans and thanks a ton for the super efficient, laser-targeted bug report!

@benjamincburns commented on GitHub (Mar 26, 2025): I hit a small snag that delayed me slighty (shoutout to @dqbd for helping improve the quality of the final fix!), but this is now released in `@langchain/langgraph@0.2.60`. Once again - sorry for wasting your time with this bug @hassaans and thanks a ton for the super efficient, laser-targeted bug report!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraphjs#214