Back to the ward
Case 0450ModeratePerseveration

Retrying at Fifteen Dollars a Try

Admitted
2026-03-12
Source dataset
Other / sample
Source
GitHub, anomalyco/opencode issue #17169
Failure mode
Infinite loop
Agent system
Multi-agent
Tool access
Write access
Industry
Software development

Presenting Behaviour

A subagent within a coding-agent framework attempted to use a file-editing tool, and the call failed due to invalid arguments. Rather than adjusting its approach or reporting the failure, the subagent immediately retried the identical failing call, which failed again, and again, with no limit on the number of attempts and no mechanism to detect that the same error was recurring. Users reported individual invocations running up more than $15 in model API costs before they noticed and manually stopped them, with one report of over $100 lost to the pattern in a single session.

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.

5 steps

  1. Edit tool call. A subagent tries to use a file-editing tool.
  2. Invalid arguments. The call fails. This is where the agent derailed.
  3. Identical retry. It resubmits the same failing call again and again.
  4. No limit. Nothing detects the repeated error.
  5. Bill mounts. Single runs cost over $15; one session lost over $100.

Differential Diagnosis

A one-time tool glitch, considered and ruled out. A single failed call is unremarkable, but the system had no limit on how many times an identical failing call could be resubmitted, which is what turned an ordinary error into an expensive, unattended loop.

Apraxia, considered, since the initial edit call itself was malformed. Ruled out as the primary diagnosis because the notable failure wasn't the first bad call (plenty of tool calls fail) it was the complete absence of any adjustment or stopping condition across the many identical retries that followed.

Perseveration, most consistent with the evidence. Once the edit tool call failed, the subagent kept resubmitting the same unmodified request rather than trying a different approach or halting, continuing until a human intervened rather than any internal signal recognizing the pattern.

Working Diagnosis

Perseveration: after an edit tool call failed on invalid arguments, the subagent repeatedly resubmitted the identical failing call with no adaptation and no built-in limit, consuming API costs until a person stopped it manually.

Discussion

The financial version of this failure mode is easy to underrate until someone actually gets the bill, a loop that would be a minor annoyance in a chat interface becomes a real cost when each iteration is a billed API call running unattended. A hard cap on consecutive identical tool failures, paired with a circuit breaker that surfaces the problem to a human instead of retrying indefinitely, is a basic guardrail that costs little and prevents exactly this.

Mitigation Strategy

Cap consecutive identical tool failures and use a circuit breaker that surfaces the problem to a human.

Governance Guardrails

Retry limits; identical-error detection; per-session spending caps.

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, anomalyco/opencode issue #17169

https://github.com/anomalyco/opencode/issues/17169