claude-code - 💡(How to fix) Fix Recursive call of claude fro claude-code uses all tokens in moments before I can stop it [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#56072Fetched 2026-05-05 05:58:55
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Timeline (top)
labeled ×4commented ×1

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.

Error Message

Error Messages/Logs

Root Cause

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.

Code Example

(timed out after 60s)

---

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

---

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

---

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

---

please recall memories

---

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

---

please run test --coverage

---

L8: Bash(command,description)

---

no output, states usage limit reached once it has eaten them all
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • 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

FieldValue
OSLinux-6.17.0-1014-nvidia-aarch64-with-glibc2.39
Archaarch64
Python3.12.3
claude --version2.1.126 (Claude Code)
node --versionv22.22.2
npm --version10.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
  • 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

  • Updated to latest version (npm i -g @anthropic-ai/claude-code)
  • Verified --dangerously-skip-permissions / auto-accept is off
  • Reviewed ~/.claude/settings.json for parallel/subagent config
  • 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

extent analysis

TL;DR

The issue can be mitigated by disabling the rust-analyzer-lsp plugin in the ~/.claude/settings.json file.

Guidance

  1. Disable the rust-analyzer-lsp plugin: Set "rust-analyzer-lsp@claude-plugins-official" to false in ~/.claude/settings.json to prevent potential conflicts or recursive calls.
  2. Monitor CPU/GPU usage: Keep an eye on system resources after disabling the plugin to ensure the issue is resolved.
  3. Review session logs: Analyze recent session logs to identify any patterns or tool calls that may be contributing to the recursive loop.
  4. Test with a minimal prompt: Try running Claude Code with a simple prompt to see if the issue persists.

Example

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

Notes

The exact cause of the recursive loop is unclear, but disabling the rust-analyzer-lsp plugin may help mitigate the issue. Further investigation into the session logs and tool calls may be necessary to identify the root cause.

Recommendation

Apply workaround: Disable the rust-analyzer-lsp plugin to prevent potential conflicts or recursive calls, and monitor system resources to ensure the issue is resolved.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix Recursive call of claude fro claude-code uses all tokens in moments before I can stop it [1 comments, 2 participants]