Skip to content

[BUG] Github Issue Prompt Too Long #23377

Description

@cheizdo2-art

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

Bug: "Prompt is too long" Error Makes Sessions Completely Unusable

Description

The "Prompt is too long" error completely breaks active Claude Code sessions. Once this error appears, every single subsequent input returns the same error message, making the session permanently unusable and forcing users to lose all conversation context.

Severity

🔴 CRITICAL - Session-breaking bug

Environment

  • Claude Code Version: Latest (2026-02-05)
  • OS: Windows 11
  • Model: Claude Sonnet 4.5
  • Interface: VSCode Extension

Steps to Reproduce

  1. Start a coding session with multiple file operations
  2. Continue conversation for 200+ messages
  3. Read several files (especially large ones)
  4. Suddenly receive: Prompt is too long
  5. Try to send any message
  6. Result: Every message returns Prompt is too long
  7. Session is now permanently broken

Expected Behavior

✅ Users should receive warnings before hitting the limit
✅ Should offer automatic context management options
✅ Should provide recovery mechanisms (e.g., /clear context)
✅ Should never completely lock a session

Actual Behavior

❌ No warning before the error occurs
❌ No way to recover the session
❌ Every input returns the same error
❌ Must close tab and lose ALL context
❌ Must manually search .jsonl files to recover work


Impact

User Quote (translated from Spanish):

"THERE'S A VERY UNPLEASANT BUG THAT SCREWS UP MY WINDOWS AND PROJECT CONTEXT. SUDDENLY THIS MESSAGE APPEARS 'Prompt is too long' AND YOU CAN NEVER WRITE AGAIN BECAUSE EVERY WORD YOU TYPE RESPONDS WITH THE SAME 'Prompt is too long'. I'M REALLY FED UP WITH THIS BUG"

Real-world impact:

  • 🚫 Hours of conversation context lost instantly
  • 🚫 Deep work interrupted without warning
  • 🚫 Must start from scratch in new session
  • 🚫 Users lose trust in Claude Code reliability
  • 🚫 Session file: 76 MB / 12,854 messages lost

Proposed Solutions

🔥 Quick Fixes (High Priority)

  1. Warning System

    • 70% full: "Context filling up - consider clearing"
    • 85% full: "Context almost full - action needed"
    • 95% full: "CRITICAL: Context nearly full"
  2. Emergency Recovery Command

    • Add /recover command that works even when context is full
    • Auto-summarizes and clears old context
    • Preserves last 20-30 messages
  3. Visual Context Indicator

    • Progress bar showing context usage
    • Color-coded: 🟢 Green (0-60%) → 🟡 Yellow (60-85%) → 🔴 Red (85-100%)

🎯 Long-term Solutions

  1. Automatic Context Management

    • Auto-summarize old messages at 80% capacity
    • Keep recent detailed context
    • Store full history but load summaries
  2. Smart Context Pruning

    • Remove redundant information automatically
    • Keep: decisions, code changes, important findings
    • Remove: intermediate debugging, repeated reads
  3. Streaming Context Window

    • Summarize oldest messages as new ones arrive
    • Maintain sliding window of detailed context

Current Workarounds

Users must manually:

  • Run /clear context every 50-100 messages
  • Avoid reading large files entirely
  • Use offset/limit when reading files
  • Start new sessions frequently
  • Manually search .jsonl files to recover context 😞

None of these are acceptable solutions.


Technical Details

Token Limit: ~200,000 tokens

Session Data Location:

~/.claude/projects/[project-name]/[session-id].jsonl

Example Broken Session:

  • File: abdb81bf-58ee-4c29-8005-1c6ec7e30848.jsonl
  • Size: 76 MB
  • Messages: 12,854 lines
  • Lost: Multiple hours of wallet analyzer implementation

Suggested Settings

{
  "context": {
    "auto_manage": true,
    "warn_at_percent": 70,
    "auto_summarize_at_percent": 85,
    "preserve_recent_messages": 50
  }
}

Reproduction Rate

100% - Happens to every user with long enough sessions. This is not an edge case.


Priority Request

This bug severely impacts productivity and user experience. Please prioritize:

  1. Immediate (days): Add warning system
  2. Short-term (1-2 weeks): Add recovery command
  3. 🎯 Medium-term (1 month): Implement auto context management
  4. 🚀 Long-term (2-3 months): Redesign context window

Additional Notes

  • Affects all users who have long sessions
  • Makes Claude Code unreliable for serious development
  • Users are extremely frustrated by this issue
  • Context recovery is currently painful and manual

Thank you for addressing this critical issue! 🙏

What Should Happen?

05

Error Messages/Logs

none

Steps to Reproduce

BUG_REPORT_PROMPT_TOO_LONG.md

Claude Model

Not sure / Multiple models

Is this a regression?

Yes, this worked in a previous version

Last Working Version

No response

Claude Code Version

lastest

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

VS Code integrated terminal

Additional Information

.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions