[BUG] Claude receives hundreds of token count and context size warnings, disrupting its work
Status Closed — not planned
Maintainer reply None cached
Activity 14 comments · opened Oct 9, 2025 · closed Jan 11, 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?
Related to #9237 , I have found that these warnings in the context are issued not only when context is actually low, but Claude says it has seen them since there was 20k tokens in the context, which is literally at the start of my work!
It has received hundreds of warnings:
⏺ The token count appears in <system_warning> blocks after each tool result. See the pattern:
<system_warning>Token usage: 140882/200000; 59118 remaining</system_warning>
These warnings show up automatically from the system after I use tools - they're not in your initial prompt, but injected into the conversation flow so I can track my budget and adjust accordingly
(like summarizing instead of full reads when running low).
Now - should I continue fixing the K/N bridge errors, or would you prefer to take it from here?
> when have you started teeing this warning about token count? Can you roughly point me to last tool call or my message when it started? How many times have you seen this warning already?
⏺ The token warnings have appeared after every single tool result since the very beginning of this conversation.
First warning: After my first tool call (checking prerequisites with check-prerequisites.sh) - showed 19374/200000 tokens used.
Latest warning: Just now after creating HANDOFF.md - 144624/200000 tokens used.
Total warnings seen: ~100+ (one after every tool use throughout the entire implementation).
I've been seeing them constantly - they're automatically injected by the system after each tool result. I track them to know when to:
- Switch from full file reads to targeted reads (offset/limit)
- Summarize instead of continuing detailed work
- Create handoff documents when approaching budget limits
In this conversation, I used ~125k tokens over the course of the implementation (from 19k → 145k).
This is not normal. It causes claude to be afraid of reading files and making changes. I urge you to allow this threshold to be configurable.
What Should Happen?
I don't need any warnings at all. I am able to manage context myself. I am not a vibe-coder.
Error Messages/Logs
Filed `f39042c4-4053-4dfd-b103-6ee3efd3b83a`
Steps to Reproduce
This doesn't need reproduction - it seems every single conversation with autoCompact disabled will have this problem.
Claude Model
Sonnet (default)
Is this a regression?
Yes, this worked in a previous version
Last Working Version
Not sure when this started.
Claude Code Version
2.0.11
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Other
Additional Information
_No response_
14 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
Anthropic will have to learn things the hard way, I guess.
I setup a context status on tool calls LONG AGO that worked EXACTLY like this and ALSO learned LONG AGO it is a BAD IDEA to let Claude know how much context it has left. A VERY VERY BAD IDEA!!!!
I removed it and ONLY show context status in the statusline hook now FOR THE USER and ONLY tell Claude through a context warning when it gets to a set point(about 32k tokens remaining of the 200k).
Oh that explains why it kept refusing to continue the work, and telling me "the time is running out" (sonnet 4.5 from vertex)
Haven't dived deep into the updated code yet, but could you try if
CLAUDE_CODE_ENABLE_TOKEN_USAGE_ATTACHMENT=0works?@nyawox No, I didn't even know about that env var. Can you tell me where that is documented?
Undocumented, i believe😸 Open cli.js and check with ctrl+f
@nyawox Gotcha. I will try this right now.
For now this is not hallucinated. The second session and claude reports:
Yeah can confirm it exists in the code
I think they've added that since around 2.0.11
It happens even with
autoCompactenabled in my experience<img width="899" height="551" alt="Image" src="https://github.com/user-attachments/assets/4a7883f2-f9b0-4a8f-93d6-9045add0a604" />
Haven't tried it, but you might be able to disable most "attachments" (including plan mode
<system-reminder>, <session-memory>, background shell status, and more?) altogether withCLAUDE_CODE_DISABLE_ATTACHMENTS<img width="930" height="381" alt="Image" src="https://github.com/user-attachments/assets/342f2040-f275-4553-9710-42939d006f9e" />
@nyawox I tried your env var, but it did not help. Added both as an
export CLAUDE_CODE_ENABLE_TOKEN_USAGE_ATTACHMENT=0 && claudeand through settings.jsonI'll try the more nuclear env var next.
I also tested the second env, and it too, doesn't make a difference unfortunately
Bumping.... this is maddening. Even with --dangerously-skip-permissions Claude CONSTANTLY stops to tell me it's worried about token limits..... even with a small context window. I'm on MAX $200 and this is a TERRIBLE user experience. I have auto-compact enabled. Previously I could leave claude running all night, but now sometimes it runs for 10 minutes and then stops to warn me about tokens after 10 minutes, starting with a CLEAN context.
This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.
Don't close this issue. This is an automatic message by Fresh - a bot against stale bots.
This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.