claude-code - 💡(How to fix) Fix [Bug] Excessive token consumption during model initialization or analysis [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#51699Fetched 2026-04-22 07:55:13
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Author
Timeline (top)
labeled ×4commented ×1

Error Message

[{"error":"Error: ENOENT: no such file or directory, unlink 'C:\Users\ben\AppData\Local\Temp\claude\C--Users-ben\54b34086-2767-4ace-9abb-28133e5dbfda\tasks\a1ca351493370355f.output'\n at async <anonymous> (B:/~BUN/root/src/entrypoints/cli.js:7979:299)","timestamp":"2026-04-21T02:18:45.259Z"},{"error":"Error: ENOENT: no such file or directory, unlink 'C:\Users\ben\AppData\Local\Temp\claude\C--Users-ben\54b34086-2767-4ace-9abb-28133e5dbfda\tasks\a53a454aaeaddfcd3.output'\n at async <anonymous> (B:/~BUN/root/src/entrypoints/cli.js:7979:299)","timestamp":"2026-04-21T02:20:02.239Z"},{"error":"Error: ensureToolResultPairing: repaired missing tool_result blocks (7 -> 7 messages). Message structure: [0] user; [1] assistant(id=msg_01SstcUXaU2Rn57qRUvzLfPx, tool_uses=[toolu_01AtNtN9sSi46nsxjUGWxf7g]); [2] user(tool_results=[toolu_01AtNtN9sSi46nsxjUGWxf7g]); [3] assistant(id=msg_01979teX2TCLpoWtPt2Jvq12, tool_uses=[toolu_015EeBK5CWKN4ZbzioWmErEe]); [4] user(tool_results=[toolu_015EeBK5CWKN4ZbzioWmErEe]); [5] assistant(id=msg_012Sc8QvVz7r82UVfQGvm7uw, tool_uses=[toolu_01CPXWxD9n9sp6BogwCpX4WT]); [6] user\n at C0_ (B:/~BUN/root/src/entrypoints/cli.js:5285:10250)\n at Qi_ (B:/~BUN/root/src/entrypoints/cli.js:8129:16029)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-04-21T02:20:44.969Z"}]

Code Example

[{"error":"Error: ENOENT: no such file or directory, unlink 'C:\\Users\\ben\\AppData\\Local\\Temp\\claude\\C--Users-ben\\54b34086-2767-4ace-9abb-28133e5dbfda\\tasks\\a1ca351493370355f.output'\n    at async <anonymous> (B:/~BUN/root/src/entrypoints/cli.js:7979:299)","timestamp":"2026-04-21T02:18:45.259Z"},{"error":"Error: ENOENT: no such file or directory, unlink 'C:\\Users\\ben\\AppData\\Local\\Temp\\claude\\C--Users-ben\\54b34086-2767-4ace-9abb-28133e5dbfda\\tasks\\a53a454aaeaddfcd3.output'\n    at async <anonymous> (B:/~BUN/root/src/entrypoints/cli.js:7979:299)","timestamp":"2026-04-21T02:20:02.239Z"},{"error":"Error: ensureToolResultPairing: repaired missing tool_result blocks (7 -> 7 messages). Message structure: [0] user; [1] assistant(id=msg_01SstcUXaU2Rn57qRUvzLfPx, tool_uses=[toolu_01AtNtN9sSi46nsxjUGWxf7g]); [2] user(tool_results=[toolu_01AtNtN9sSi46nsxjUGWxf7g]); [3] assistant(id=msg_01979teX2TCLpoWtPt2Jvq12, tool_uses=[toolu_015EeBK5CWKN4ZbzioWmErEe]); [4] user(tool_results=[toolu_015EeBK5CWKN4ZbzioWmErEe]); [5] assistant(id=msg_012Sc8QvVz7r82UVfQGvm7uw, tool_uses=[toolu_01CPXWxD9n9sp6BogwCpX4WT]); [6] user\n    at C0_ (B:/~BUN/root/src/entrypoints/cli.js:5285:10250)\n    at Qi_ (B:/~BUN/root/src/entrypoints/cli.js:8129:16029)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-21T02:20:44.969Z"}]
RAW_BUFFERClick to expand / collapse

Bug Description Claude burned 103k tokens just looking into the model. I don't really understand how that could possibly have required that much effort/investigation. That's a ludicrous number of tokens to use here.

It wasn't so much an error as it was the irresponsible consumption of tokens in what I have to imagine was a very basic request. I was restarting a conversation with claude that had some background, but not overly extensive background, and when I resumed the conversation claude kicked off two exploratory agents. One to explore the codebase, and another that failed. They also checked on the MCP tools we had available and in all that quick restart consumed 103k tokens. That's like 75k words or something!

I use claude code frequently and I don't think I've ever seen a number that big restarting a conversation with Claude.

Environment Info

  • Platform: win32
  • Terminal: windows-terminal
  • Version: 2.1.116
  • Feedback ID: dae37280-19de-4d8d-ba86-157660ab03ef

Errors

[{"error":"Error: ENOENT: no such file or directory, unlink 'C:\\Users\\ben\\AppData\\Local\\Temp\\claude\\C--Users-ben\\54b34086-2767-4ace-9abb-28133e5dbfda\\tasks\\a1ca351493370355f.output'\n    at async <anonymous> (B:/~BUN/root/src/entrypoints/cli.js:7979:299)","timestamp":"2026-04-21T02:18:45.259Z"},{"error":"Error: ENOENT: no such file or directory, unlink 'C:\\Users\\ben\\AppData\\Local\\Temp\\claude\\C--Users-ben\\54b34086-2767-4ace-9abb-28133e5dbfda\\tasks\\a53a454aaeaddfcd3.output'\n    at async <anonymous> (B:/~BUN/root/src/entrypoints/cli.js:7979:299)","timestamp":"2026-04-21T02:20:02.239Z"},{"error":"Error: ensureToolResultPairing: repaired missing tool_result blocks (7 -> 7 messages). Message structure: [0] user; [1] assistant(id=msg_01SstcUXaU2Rn57qRUvzLfPx, tool_uses=[toolu_01AtNtN9sSi46nsxjUGWxf7g]); [2] user(tool_results=[toolu_01AtNtN9sSi46nsxjUGWxf7g]); [3] assistant(id=msg_01979teX2TCLpoWtPt2Jvq12, tool_uses=[toolu_015EeBK5CWKN4ZbzioWmErEe]); [4] user(tool_results=[toolu_015EeBK5CWKN4ZbzioWmErEe]); [5] assistant(id=msg_012Sc8QvVz7r82UVfQGvm7uw, tool_uses=[toolu_01CPXWxD9n9sp6BogwCpX4WT]); [6] user\n    at C0_ (B:/~BUN/root/src/entrypoints/cli.js:5285:10250)\n    at Qi_ (B:/~BUN/root/src/entrypoints/cli.js:8129:16029)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-21T02:20:44.969Z"}]

extent analysis

TL;DR

The issue is likely due to excessive token consumption by Claude's exploratory agents, and a potential workaround is to limit the scope of the conversation or investigate the errors causing the agents to fail.

Guidance

  • Investigate the ENOENT errors in the error log, which may indicate issues with file access or temporary directory management, potentially contributing to the excessive token consumption.
  • Review the conversation history and background information to determine if there are any specific topics or keywords that may be triggering the exploratory agents, and consider limiting the scope of the conversation to reduce token usage.
  • Check the tool usage and results in the conversation to ensure that they are necessary and not causing unnecessary token consumption.
  • Consider reporting the issue with the provided Feedback ID to the development team for further investigation and potential optimization of the token usage.

Example

No specific code snippet can be provided without further information on the conversation or the Claude model being used.

Notes

The issue may be specific to the Windows platform or the version of the software being used, and further investigation is needed to determine the root cause of the excessive token consumption.

Recommendation

Apply a workaround by limiting the scope of the conversation and investigating the errors causing the exploratory agents to fail, as the root cause of the issue is unclear and may require further investigation by the development team.

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 [Bug] Excessive token consumption during model initialization or analysis [1 comments, 2 participants]