Context low warning and /compact failure despite having 86% free context space
Description
Claude Code incorrectly shows "Context low · Run /compact to compact & continue" warning messages even when there is plenty of context space available (86% free). The /compact command also fails with an error, preventing normal usage.
Environment
- OS: macOS (Darwin 24.6.0)
- Claude Code Version: Latest
- Model: claude-sonnet-4-20250514
Steps to Reproduce
- Start Claude Code in any project
- Run /context to check usage
- Context shows 26k/200k tokens used (13% usage, 86% free)
- Attempt to ask any question
- System shows "Context low" warning
- Run /compact command
- Command fails with error
Expected Behavior
- No "Context low" warning when 86% of context is free
- /compact command should work or not be needed with this much free space
- Should be able to ask questions normally
Actual Behavior
- "Context low" warning appears immediately, even on fresh conversations
- /compact command fails with: "Error during compaction: Error: Conversation too long. Press esc to go up a few messages and try again."
- System interrupts and prevents normal question asking
Context Usage Details
Context Usage claude-sonnet-4-20250514 • 26k/200k tokens (13%)
⛁ System prompt: 4.0k tokens (2.0%) ⛁ System tools: 11.6k tokens (5.8%) ⛁ MCP tools: 10.6k tokens (5.3%) ⛁ Messages: 265 tokens (0.1%) ⛶ Free space: 173.5k (86.8%)
Additional Notes
- This happens "every time" and "on the first question" according to the user
- Occurs even with fresh restarts
- Context window includes standard system tools and MCP tools (filesystem, memory)
- Issue persists across different conversations and projects
Impact
This bug prevents normal usage of Claude Code, as the system incorrectly believes context is full and interrupts user interactions.
Additional Diagnostic Information
Claude Code Version: 1.0.92 (@anthropic-ai/claude-code@^1.0.92)
MCP Configuration:
- Active MCP servers: Supabase (12 tools) and Vercel (16 tools)
- This may explain the 10.6k tokens used by MCP tools in the baseline context
Configuration Files:
- Settings:
{"model": "sonnet"} - MCP config includes Supabase and Vercel integrations
- Project-based configuration active
Request for Investigation:
- Whether MCP server count affects context calculation thresholds
- If the warning threshold is incorrectly triggered by MCP tool token usage
- Why
/compactfails when actual usage is only 13%
I do not believe this issues is fixed yet but I have done a few things to help it.
1 - reset context and client 2 - switched to a different model, entered a few commands, switched back. 3 - I had a couple of large custom MCP servers that were only consuming 10K tokens, but I removed them
Issue is still happening, this is on a new thread.
⎿ Context low · Run /compact to compact & continue
/model ⎿ Set model to opus (claude-opus-4-1-20250805)
confinue ⎿ Context low · Run /compact to compact & continue
/compact ⎿ Error: Error during compaction: Error: Conversation too long. Press esc to go up a few messages and try again.
/model ⎿ Set model to sonnet (claude-sonnet-4-20250514)
continue ⎿ Context low · Run /compact to compact & continue
/compact ⎿ Error: Error during compaction: Error: Conversation too long. Press esc to go up a few messages and try again.
Running into this same issue over the past few hours.
Thanks for the report! Can you guys please paste the output of /doctor here?
It's all the time now (v2.0.2), absolutely broken. Auto compaction doesn’t trigger almost every time, and manual compaction never works, literally never.
Btw, "Press esc twice to go up" is also broken useless — it doesn't allow you to navigate through the actual messages of the model; it only allows you to navigate through user messages. Usually, I only have one message at the very beginning of the conversation. So it's absolutely useless to compact from it.
Even if I have messages further down in the conversation, it doesn't help. I can continue the conversation, but it still doesn't trigger compaction automatically, and if I try to call it manually, it fails every time.
I wanted to add another example of this bug - I'm also seeing the Context low - Run /compact to compact & continue warning even when my context window usage is actually low, but I'm also getting hints to try sonnet[1m] even when I'm already using that exact model
Below is a screenshot that illustrates the problem. You can see according to the /context slash command my session is only at 16% context usage, but I see:
- The
Run /compact to continuewarning claiming I only have 7% remaining (same as other folks) - The inline chat hint advising me
7% context left - try /model sonnet[1m]but you can see I'm already the 1M token context variant of Sonnet 4.5 (this is the new part I haven't seen other folks mention yet)
I am seeing the same error in Claude Code on my Mac using Sonnet 4.5
Just ran into this bug when I noticed the autocompaction happening pretty early. It's a major WTF to see this too:
I first presumed it might be an odd bug with autocompaction because, like, why else would the autocompact buffer be EIGHT HUNDRED AND FORTY FIVE THOUSAND TOKENS LONG, but turning off autocompact does not help.
Okay did someone just push a change
Nah...
> /doctor
Diagnostics
└ Currently running: package-manager (2.0.37)
└ Package manager: homebrew
└ Path: /opt/homebrew/bin/claude
└ Invoked: /opt/homebrew/Caskroom/claude-code/2.0.37/claude
└ Config install method: global
└ Auto-updates: Managed by package manager
└ Search: OK (bundled)
Additional data point - November 16, 2025
Experiencing the same issue with significant MCP tool overhead.
Context breakdown (from /context command):
- claude-sonnet-4-5-20250929 · 157k/200k tokens (78%)
- System prompt: 2.9k tokens (1.4%)
- System tools: 15.4k tokens (7.7%)
- MCP tools: 15.0k tokens (7.5%) ← workspace + workspace-developer MCPs
- Memory files: 5.6k tokens (2.8%)
- Messages: 117.9k tokens (58.9%)
- Free space: 43k (21.7%)
UI Display:
- Shows "Context low (10% remaining)" in red warning bar
- /context command reports 21.7% remaining (43k tokens)
- System warnings in tool results report ~52k tokens remaining (26%)
Configuration:
- 2 MCP servers: workspace (13 tools), workspace-developer (2 tools)
- 3 CLAUDE.md memory files loaded
- Model: claude-sonnet-4-5-20250929
Observation:
The MCP tools overhead (~15k tokens) appears to be confusing the UI gauge calculation. The gauge seems to treat static overhead (MCP tools + system tools + memory files = ~36k tokens) as consuming "message budget" rather than recognizing it as fixed infrastructure cost.
With 43k-52k tokens actually remaining, I can continue productive work, but the UI incorrectly suggests the session is nearly exhausted.
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.
happend to me when local claude.md was too large.