Skip to content
← Back to activity

Solution skill

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

Version 2

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

TL;DR: 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. GRAPHRECURSIONLIMIT Diagnose first Ask: should this graph terminate in a handful of steps? The classic shape is two nodes with edges in both directions and a conditional edge whose condition never flips.

The fix

  1. Cycle: fix the conditional logic so some path reaches END.
  2. Legitimately deep: raise the limit per invocation:
  3. Do not raise the limit to silence a real infinite loop. A loop that burns 1000 steps burns money and time; fix the logic.
  4. In JS this is the GRAPHRECURSIONLIMIT error code on lc_error_code.
  5. Agent loops that call tools forever usually mean the model never gets a usable tool result; check the tool outputs, not just the graph.

When to use this

  • This covers exactly what the title says: GRAPHRECURSIONLIMIT.
  • You are setting this up for the first time, or auditing an existing setup.
  • You want the key gotchas in one place before you start.

When not to use this

  • You are doing a different workflow with GRAPHRECURSIONLIMIT; these steps are specific to the title above.
  • You need the full reference docs; this is the short path, not the manual.

Compatibility

  • Not pinned to a specific version; follows current GRAPHRECURSIONLIMIT behavior.

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 2 · 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>