Premature "Context limit reached" at ~51% when submitting image during active processing
Environment
- Claude Code: v2.1.34
- Model: Opus 4.6
- OS: macOS Darwin 25.2.0
Bug Description
Context limit is triggered at ~51% utilization (per status bar) — well under half capacity — when submitting a message that includes a screenshot image while Claude Code is actively processing (running tool calls, mid-response). This is distinct from #23047 where /compact fails at actual context limits; here the limit itself fires prematurely, wasting over half the context window.
Steps to Reproduce
- Start a normal development session with tool-heavy workflows (file reads, bash commands, edits)
- Let Claude Code begin processing a multi-step response (tool calls in progress)
- While processing is active, submit a new message that includes a screenshot/image attachment
- Context immediately jumps to "limit reached" at ~51% — session is deadlocked
What Happens
- Status bar shows ~51% context — nowhere near full
Context limit reached · /compact or /clear to continueblocks all input/compactfails:Error: Error during compaction: Error: Conversation too long. Press esc twice to go up a few messages and try again.continueis also blocked by the same context limit gate- No recovery path — forced to kill the process entirely, restart Claude Code, re-run project restoration, and manually reconstruct session state
Key Observations
- Only happens with image + mid-processing timing — in my experience, this never triggers during normal text-only interaction or when submitting images while Claude Code is idle
- Triggers at ~51%, not near 100% — over half the context window is wasted
- Heavy tool use sessions are more susceptible — sessions with many file reads, bash commands, and multi-step agentic workflows
- Large system prompts may contribute — projects with substantial CLAUDE.md files and multiple skills loaded
- Auto-compact never fires — the session goes straight from working to deadlocked, no automatic compaction attempt in between
Impact
This effectively caps usable session length to roughly 30-60 minutes for tool-heavy development workflows. Recovery requires killing the process, restarting Claude Code, re-running project setup/restoration commands (which themselves consume context), and manually copying relevant portions from the dead session. This full recovery cycle happens multiple times per day, each costing 5-10 minutes plus the context overhead of re-establishing state.
Likely Cause
Something about submitting an image while a response is actively streaming/processing appears to corrupt the context accounting — possibly double-counting tokens, failing to properly handle the concurrent message, or miscalculating image token costs in that race condition.
Related
- #23047 —
/compactfails when context limit is legitimately reached. That's a separate issue (compaction catch-22). This bug is about the limit triggering prematurely due to image submission timing.
This issue has 10 comments on GitHub. Read the full discussion on GitHub ↗