Recursive call of claude fro claude-code uses all tokens in moments before I can stop it

Resolved 💬 2 comments Opened May 4, 2026 by markdurbin104-lab Closed Jun 3, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Claude Code runaway-recursion incident report

_Generated: 2026-05-04 17:16:36 UTC_

Summary

Claude Code session(s) entered a recursive tool-call loop, consuming CPU/GPU and exhausting the account token budget without producing the requested outcome. This report bundles environment information and analysis of recent session logs to help diagnose.

Environment

| Field | Value |
|---|---|
| OS | Linux-6.17.0-1014-nvidia-aarch64-with-glibc2.39 |
| Arch | aarch64 |
| Python | 3.12.3 |
| claude --version | 2.1.126 (Claude Code) |
| node --version | v22.22.2 |
| npm --version | 10.9.7 |
| which claude | ~/.nvm/versions/node/v22.22.2/bin/claude |
| which node | ~/.nvm/versions/node/v22.22.2/bin/node |

claude doctor

(timed out after 60s)

~/.claude/settings.json (redacted)

_Path: ~/.claude/settings.json_

{
  "enabledPlugins": {
    "rust-analyzer-lsp@claude-plugins-official": true
  },
  "skipAutoPermissionPrompt": true
}

Session analysis (last 7 days)

Found 7625 session file(s) modified in the window. Showing the top 3 by suspicion score (consecutive identical tool calls + total tool calls + tokens).

Suspicious session #1

  • Path: ~/.claude/projects/-home-[USER]-dev-shirika/724b1420-2f98-4ad0-8d11-e81839ddd2b2.jsonl
  • Last modified: 2026-05-02T23:37:01.582173+00:00
  • Size: 14,479,296 bytes, 4,921 lines (0 parse errors)
  • Turns: 2,346 assistant / 1,411 user (ratio: 1.7x)
  • Total tool calls: 1,320
  • Top tools: Bash ×835, Edit ×239, Read ×193, Write ×28, ScheduleWakeup ×15
  • Longest consecutive run of the same tool: 2 calls of Read (lines 891–892)
  • Tokens (reported by API): input 18,245, output 1,809,232, cache_create 16,360,663, cache_read 1,032,170,099

First user prompt (redacted, truncated):

we were running the shirika deamon in the ~/dev/revx-greencubes_devSP2 and impleneting the test analysis capabilities. please have a look at docs/running-the-pipeline.md then sin up the daemon and have a play with its mcp capabilities t stdy the project

Excerpt of the runaway region (redacted, tool calls only):

L891: Read(file_path,limit,offset)
L892: Read(file_path,limit,offset)

Suspicious session #2

  • Path: ~/.claude/projects/-home-[USER]-dev-shirika/1cfafc6e-5365-4423-9548-44f637c53e8c.jsonl
  • Last modified: 2026-04-27T20:11:04.216567+00:00
  • Size: 7,808,785 bytes, 4,580 lines (0 parse errors)
  • Turns: 1,690 assistant / 1,016 user (ratio: 1.7x)
  • Total tool calls: 761
  • Top tools: Bash ×511, Edit ×87, Read ×80, Monitor ×24, ScheduleWakeup ×19
  • Longest consecutive run of the same tool: 3 calls of Bash (lines 495–497)
  • Tokens (reported by API): input 3,884, output 1,260,918, cache_create 8,824,621, cache_read 781,266,357

First user prompt (redacted, truncated):

please recall memories

Excerpt of the runaway region (redacted, tool calls only):

L495: Bash(command,description)
L496: Bash(command,description)
L497: Bash(command,description)

Suspicious session #3

  • Path: ~/.claude/projects/-home-[USER]-dev-revx-greencubes-devSP2/ab39c1c1-ac42-4bba-996e-32b4d0d71ec5.jsonl
  • Last modified: 2026-05-02T23:36:00.620919+00:00
  • Size: 1,488,054 bytes, 782 lines (0 parse errors)
  • Turns: 353 assistant / 217 user (ratio: 1.6x)
  • Total tool calls: 200
  • Top tools: Bash ×118, Read ×36, Edit ×15, TaskUpdate ×14, Write ×9
  • Longest consecutive run of the same tool: 1 calls of Bash (lines 8–8)
  • Tokens (reported by API): input 533, output 162,444, cache_create 1,441,808, cache_read 40,986,466

First user prompt (redacted, truncated):

please run test --coverage

Excerpt of the runaway region (redacted, tool calls only):

L8: Bash(command,description)

Reproduction

  • [ X] I can reproduce this on demand: _yes / no / sometimes_
  • [ ] Steps to reproduce (fill in):
  1. run claude in any folder
  2. type any prompt
  • [X] Expected behaviour: _Claude Code stops after completing the task without recursive self-invocation._
  • [X ] Actual behaviour: _runaway tool-call loop, CPU/GPU saturation, token budget exhausted._

What I have already tried

  • [X] Updated to latest version (npm i -g @anthropic-ai/claude-code)
  • [X] Verified --dangerously-skip-permissions / auto-accept is off
  • [X] Reviewed ~/.claude/settings.json for parallel/subagent config
  • [X] Reboot to kill process

---

_Report generated by claude_code_runaway_report.py. Tokens, emails, and home-directory paths have been redacted, but please skim once more before sending._

What Should Happen?

It should act normally

Error Messages/Logs

no output, states usage limit reached once it has eaten them all

Steps to Reproduce

run claude in any folder

Claude Model

Not sure / Multiple models

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

2.1.126 (Claude Code)

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

Xterm

Additional Information

_No response_

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗