[Bug] Context limit reached prematurely - /context shows 74.4% remaining but context blocked

Resolved 💬 3 comments Opened Jan 23, 2026 by 1saifj Closed Jan 27, 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?

/context command shows 70%+ free space available, but Claude Code still blocks further execution with "Context limit reached · /compact or /clear to continue" error message. This prevents continued workflow despite abundant remaining context capacity.

What Should Happen?

Claude Code should allow continued execution when /context shows >50% free space remaining. The context limit check should align with actual remaining capacity. If approaching true system limit, /context display should show accurate warning (e.g., <10% remaining) instead of blocking at 70% free space.

Error Messages/Logs

Context limit reached · /compact or /clear to continue

/context output at time of error:
- Total capacity: 200k tokens
- Tokens used: 46k (23%)
- Free space: 154k (77%)
- Autocompact buffer: 45.0k tokens (22.5%)

Steps to Reproduce

  1. Start Claude Code v2.1.15 (latest)
  2. Begin working on a project with moderate context usage (e.g., browser automation with screenshots, API responses, code reviews)
  3. Run /context command to check available capacity
  4. Observe that /context shows 70%+ free space remaining (e.g., 77% in the reported case)
  5. Attempt to continue work or make another request
  6. System blocks execution with: "Context limit reached · /compact or /clear to continue"
  7. User cannot proceed despite having abundant capacity shown in /context output

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

2.1.15

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

Impact Analysis:
This bug severely impacts workflows involving:

  • Large file operations (screenshots, binary data)
  • Browser automation with CDP (Chrome DevTools Protocol)
  • API integration work with large responses
  • Code reviews with full file contexts

Context Accounting Issue:
The discrepancy suggests the context limit check may be:

  1. Not properly accounting for free space during calculation
  2. Using a different/hidden threshold than displayed in /context
  3. Prematurely blocking based on internal state tracking

Workaround: Users must manually run /compact or /clear despite having 70%+ available capacity, losing context history unnecessarily.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗