Twenty Tries at the Same Query
- Admitted
- 2026-08-16
- Source dataset
- Other / sample
- Failure mode
- Infinite loop
- Agent system
- Tool-calling
- Tool access
- Read-only
- Industry
- Software development
Presenting Behaviour
A developer building a data-lookup agent reported that it entered a loop: it called the same database tool repeatedly with slightly varied phrasing after each attempt failed with the same underlying formatting error, never adjusting its approach to address the actual error, until it hit the system's built-in limit on consecutive tool calls and stopped. The same code had worked correctly in an earlier version of the framework.
Case Replay
A reconstruction, not a simulation. This sequence is reconstructed from the public incident record and summarised in our own words. It is a static record of what was reported, and nothing here can be run or replayed live.
4 steps
- Tool call fails. The agent's database call returns a formatting error.
- Cosmetic retries. It retries with slightly varied phrasing, ignoring the error. This is where the agent derailed.
- Loop continues. The same error returns each time.
- External stop. It halts only when the framework's recursion limit is reached.
Differential Diagnosis
A framework regression unrelated to the agent's own behaviour, a real contributing factor, since the same logic worked in a prior version. But the regression explains why the first call failed, not why the agent kept retrying an unproductive variation twenty times instead of surfacing the error.
Apraxia (understanding the tool's purpose but failing at the mechanics of calling it), considered. Each individual call was reasonably well-formed; the persistent problem wasn't in how any single call was made; it was in not stopping.
Perseveration (repeating a response after it has stopped being useful, without adjusting based on the specific error received), most consistent with the report: the agent read the error each time but generated a new query variation rather than diagnosing the actual, unchanging cause, and repeated this until an external limit (not its own judgment) stopped it.
Working Diagnosis
Perseveration: the agent retried a failing tool call with cosmetic variations rather than parsing and acting on the specific, unchanging error it was receiving, and only stopped when it hit an external recursion limit.
Discussion
This is a small, cheap version of a pattern that gets expensive fast at scale, repeated API calls, repeated charges, rate-limit exhaustion. The fix isn't a bigger retry limit; it's requiring the agent's retry logic to actually incorporate what the last error said before trying again, and to stop and surface the problem once the same error recurs rather than treating every retry as a fresh chance.
Mitigation Strategy
Make retry logic incorporate the last error, and stop and surface the problem when the same error recurs.
Governance Guardrails
Repeated-error detection; per-tool call budgets; escalation to a human after identical failures.
Typical Presentation in Human Patients
General clinical background, included for context. Not medical advice, and not a diagnosis of any individual.
Perseveration is the inappropriate repetition of a word, gesture, or action well past the point where it's still relevant or useful. It's a well-documented sign of frontal lobe dysfunction, and also appears in some forms of dementia and obsessive-compulsive disorder.
Source Note
GitHub, langchain-ai/langgraph issue #6731
https://github.com/langchain-ai/langgraph/issues/6731