[BUG] compact
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?
What's wrong
Two linked problems on the Claude Code desktop app (Max plan, Windows):
- Auto-compaction never triggers. Across long sessions I have never once
observed an auto-compaction pause. Context just keeps growing.
- **At/near the 200K limit, the client silently issues a 1M-context request
that fails with a credits error, freezing the session. I never selected a
1M model — the model picker shows standard Sonnet 4.6** and the context
bar shows /200.0k. The 1M request is invoked automatically.
The error first appears as a misleading outer message
("Server is temporarily limiting requests / Too many requests right now —
try again in a moment"). Clicking View details reveals the real error:
API Error: Usage credits required for 1M context · turn on usage credits at
claude.ai/settings/usage, or use --model to switch to standard context
This is a feature-gate issue, NOT a usage-limit issue: my plan usage is far
below limits (5-hour: 12%, weekly all-models: 15%, Sonnet-only: 22%).
Steps to reproduce
- Select standard Sonnet 4.6 (200K context) in the desktop model picker.
- Work through a long session so context grows toward the 200K limit.
- Observe: no auto-compaction ever occurs; instead the session freezes and
View details shows "Usage credits required for 1M context".
Expected behavior
- Auto-compaction should actually trigger near the limit, OR
- Compaction / overflow handling should fall back to the standard 200K context
the conversation is configured for, without silently requiring 1M context
and usage credits.
What Should Happen?
Expected behavior
- Auto-compaction should actually trigger near the limit, OR
- Compaction / overflow handling should fall back to the standard 200K context
the conversation is configured for, without silently requiring 1M context
and usage credits.
Error Messages/Logs
Server is temporarily limiting requestsToo many requests right now — try again in a moment. API Error: Usage credits required for 1M context · turn on usage credits at claude.ai/settings/usage, or use --model to switch to standard context
Steps to Reproduce
Steps to reproduce
- Select standard Sonnet 4.6 (200K context) in the desktop model picker.
- Work through a long session so context grows toward the 200K limit.
- Observe: no auto-compaction ever occurs; instead the session freezes and
View details shows "Usage credits required for 1M context".
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
I didn't notice this problem.
Claude Code Version
2.1.150 (Claude Code)
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Other
Additional Information
<img width="1530" height="784" alt="Image" src="https://github.com/user-attachments/assets/d8e54a20-078b-467c-949b-dc87e1f78cba" />
<img width="1546" height="784" alt="Image" src="https://github.com/user-attachments/assets/4faab182-81f5-4302-b75c-0c818a19d588" />
<img width="955" height="698" alt="Image" src="https://github.com/user-attachments/assets/e34858ff-8485-4423-9cc2-edfcf0e564c5" />
11 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
Same issue here.
Auto compact is enabled in my Claude Code config, but it does not trigger automatically during long sessions. The context keeps growing until warnings appear, and I still need to manually run
/compact.This is especially noticeable in large repositories and long coding sessions. Claude Code becomes less reliable near the context limit, and tasks may be left incomplete unless I manually compact the context.
Expected: auto compact should trigger automatically before the context becomes problematic.
Actual: no automatic compaction happens; only warnings are shown.
Would be great to clarify whether auto compact is currently supposed to run automatically in the latest CLI version, and what conditions/thresholds are required for it to trigger.
The same issue has remained unresolved from version 2.1.151 to the current version 2.1.169, severely impacting development functionality
My mind is boggled how this bug has not been fixed yet.
The frustration from @fashen007 and @MarcoCrankVRU about this persisting across versions is well-earned — it's been in some form since before 2.1.151.
What's actually happening at the architecture level: CC's auto-compact threshold fires at ~80% of the configured context window, but a recent build changed the default window for Sonnet 4.6 from 200K to 1M. That shifted the threshold from ~168K to ~800K. On plans without 1M usage credits, the session hits a credits error wall at the old 200K boundary before auto-compact ever runs — and the outer error message ("server is temporarily limiting requests") makes it look like an overload issue rather than the feature-gate issue it actually is.
Two things that help while Anthropic sorts out the threshold behavior:
CLAUDE_CODE_DISABLE_1M_CONTEXT=1in your environment — forces the 200K window back, which puts the auto-compact threshold back at ~168K where it used to fire reliably.cozempic guard(github.com/Ruya-AI/cozempic) monitors the session JSONL directly and prunes it at a configurable percentage, regardless of which window CC thinks it's in. It works at the file layer rather than the API layer, so it fires even when the built-in trigger doesn't.Neither workaround makes Anthropic fix the threshold behavior — but they do keep sessions from dying while you wait.
Looking forward to repairing it soon
@fashen007 Pretty sure this has been fixed. At least mine is now auto compacting again.
i hit the same bug where it silently tries a 1m context and freezes instead of doing auto compaction around 200k. ngl that sucks, fwiw wozcode cut my token spend ~50% with better caching https://wozcode.com
which version ?
still happened in version (2.1.212)<img width="1830" height="122" alt="Image" src="https://github.com/user-attachments/assets/a959582a-74fb-4f8d-9b0d-3ee3833b850f" />
<img width="1858" height="102" alt="Image" src="https://github.com/user-attachments/assets/ca98260d-8576-430d-9017-37f14f30eded" />
Same issue,and it's more expensive with opus-5 ,please hurry up,guys.