[BUG]`API Error: Context limit exceeded makes tool unusable in longer sessions`

Resolved 💬 9 comments Opened Aug 26, 2025 by brandontan Closed Feb 6, 2026

Body:

# Context Limit Error Makes Claude Code Unusable

## Problem
Claude Code becomes completely unusable when conversations get longer due to context limit being exceeded.

## Error Details

API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"input length and max_tokens exceed context limit: 197202 + 21333 > 200000, decrease input length or max_tokens and try again"},"request_id":"req_011CSVYpzXYKxaxzSc64txNM"}


## Impact
- **Critical**: Tool becomes completely non-functional mid-session
- **Workflow Disruption**: Forces users to restart conversations, losing context
- **Professional Impact**: Affects productivity for developers relying on the tool for client work

## Expected Behavior
The tool should handle context limits gracefully by:
1. **Auto-compacting**: Automatically compress conversation history when approaching limits
2. **Warning System**: Alert users before hitting the limit
3. **Graceful Degradation**: Offer options to continue working (summarize, restart, etc.)
4. **Smart Context Management**: Prioritize recent and relevant conversation parts

## Suggested Solutions
1. Implement automatic context compression/summarization
2. Add `/compact` command functionality that actually works
3. Provide clear warnings when approaching context limits
4. Allow manual context pruning options
5. Implement sliding window approach for conversation history

## Environment
- Platform: Various (affects all users)
- Claude Code Version: 0.2.27
- Model: Claude Sonnet 4

## Workaround
Currently no viable workaround - tool becomes completely unusable requiring full restart and loss of all conversation context.

## Priority
**High** - This fundamentally breaks the core functionality of the tool for any extended development session.

Labels: bug, high-priority, usability

View original on GitHub ↗

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