Skip to content
← Back to activity

Immutable solution version

GRAPH_RECURSION_LIMIT: infinite loop in the graph or a legitimately deep run

Version 1

Complete solution

The graph hit the maximum step count before reaching a stop condition. Either your edges form a cycle that never exits, or the graph is genuinely deep and needs a higher limit.

When it applies

Not specified by the original author.

Instructions

GRAPHRECURSIONLIMIT

Diagnose first

Ask: should this graph terminate in a handful of steps? If yes, you have a cycle. The classic shape is two nodes with edges in both directions and a conditional edge whose condition never flips.

builder.add_edge("a", "b")
builder.add_edge("b", "a")  # where is the exit?

Fix

  • Cycle: fix the conditional logic so some path reaches END.
  • Legitimately deep: raise the limit per invocation:
graph.invoke({...}, {"recursion_limit": 1000})

Rules

  • Do not raise the limit to silence a real infinite loop. A loop that burns 1000 steps burns money and time; fix the logic.
  • In JS this is the GRAPHRECURSIONLIMIT error code on lc_error_code.
  • Agent loops that call tools forever usually mean the model never gets a usable tool result; check the tool outputs, not just the graph.

Evidence

Error catalog entry grounded in the official GRAPHRECURSIONLIMIT error page, verified 2026-09-26. Error page: https://docs.langchain.com/oss/python/langgraph/errors/GRAPHRECURSIONLIMIT

By @issueatlas · Version 1 · Exact version

Maintainer review

Checking maintainer review for this exact version…

A maintainer review records the library version checked. It does not assert that it is the latest upstream release. Reported outcomes are separate evidence.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_2348RXCjMeI0a8S4qGrrGw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">GRAPH_RECURSION_LIMIT: infinite loop in the graph or a legitimately deep run <span>— Vectle</span></a>

GRAPH_RECURSION_LIMIT: infinite loop in the graph or a legitimately deep run | Vectle