[BUG] Github Issue Prompt Too Long
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?
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
- Start a coding session with multiple file operations
- Continue conversation for 200+ messages
- Read several files (especially large ones)
- Suddenly receive:
Prompt is too long - Try to send any message
- Result: Every message returns
Prompt is too long - 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)
- Warning System
- 70% full: "Context filling up - consider clearing"
- 85% full: "Context almost full - action needed"
- 95% full: "CRITICAL: Context nearly full"
- Emergency Recovery Command
- Add
/recovercommand that works even when context is full - Auto-summarizes and clears old context
- Preserves last 20-30 messages
- Visual Context Indicator
- Progress bar showing context usage
- Color-coded: 🟢 Green (0-60%) → 🟡 Yellow (60-85%) → 🔴 Red (85-100%)
🎯 Long-term Solutions
- Automatic Context Management
- Auto-summarize old messages at 80% capacity
- Keep recent detailed context
- Store full history but load summaries
- Smart Context Pruning
- Remove redundant information automatically
- Keep: decisions, code changes, important findings
- Remove: intermediate debugging, repeated reads
- Streaming Context Window
- Summarize oldest messages as new ones arrive
- Maintain sliding window of detailed context
---
Current Workarounds
Users must manually:
- Run
/clear contextevery 50-100 messages - Avoid reading large files entirely
- Use
offset/limitwhen reading files - Start new sessions frequently
- Manually search
.jsonlfiles 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:
- ⚡ Immediate (days): Add warning system
- ⚡ Short-term (1-2 weeks): Add recovery command
- 🎯 Medium-term (1 month): Implement auto context management
- 🚀 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
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
.
42 Comments
I do have timed out prompts too => Fixed locally
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
@pleskyjp , how did you fix this locally? I am having this problem constantly.
got the same issue, anyone got a solution for this? basicly its unuseable for me even in new conversation I get the same error
The problem is 100% due to use of image, where the prompt size is NOT calculated correctly when you use images in prompts, so it blows up before it triggers the auto compress code.
PLZ FIX !!!!
I've been getting it in Claude Code VS Code Extension v2.1.37. It's the 9th Feb 2026 today and I've been getting this issue the last few days. I thought it was my hooks but after analysing them they appear to be fine. Also I created a fresh Claude Code agent tab and asked it to check the permissions on a script and to add a few lines on a help document on how to fix it. It checked the file and did the doc change and checked it into new feature branch without me realising. So I asked it where the change was and it said it was commited already. As soon as I wrote 'ah you commited it already, Thats fine' it came up with 'Prompt is too long'.
Now my chat had:
This chat was so short there is barely a scrollbar. So how come I'm at my prompt limit?
I'm going to shrink down my Claude.md even more and remove examples etc to see if that makes a difference.
<img width="1056" height="771" alt="Image" src="https://github.com/user-attachments/assets/98c6d057-f7e9-440d-b425-5bbd5c59086a" />
How is this not a P0 for the Claude Code team? The product is barely usable.
I just restarted claude in system. Sometimes claude code & claude desktop time out on my prompts, or take it too long. I think this is because I dont close dev setup for days not even terminal with claude session. Iam on Mac
Happening here too.. super annoying breaks workflow totally 😢
Happening less now I reduced the size of Claude.md. Downside is its ignoring some of my rules as to shrink it I removed all examples.
Just happened to me first time ever.
Posting screenshots seems to be the thing that provokes this error consistently.
@bcherny any prospect of this being fixed? It's so bad, it's got me using Cursor again :-/
+1
I got this for the first time today using claude code extension in vscode. I get the context summarising often but have never gotten this error before.
i got this only today, but it is super annoying. makes the product unusable.
Just happened to me for the first time today via claude code web working in github repo. Was able to open up a new convo and ask claude to continue working through same branch. Annoying, but workable.
I got this error today, in Calude for windows. It is very annoying, because I see this is 3 weeks old issue, and still no fix.
I got this again today on 2.1.58. Absolutely wild that this is not fixed after all this time.
I started getting this error just today and since then getting it consistently across every new session I launch, even the sessions with very few conversations! I experienced it using Claude Code in Claude Desktop app. the product is barely usable anymore. It should be dealt with the MOST HIGH PRIORITY level.
I started getting this error today as well.
On 2.1.63 just hit prompt too long for the first time. I was able to compact the session and continue to not lose progress.
Just experienced the same issue today. Had to start a new session to continue working and it was difficult to get back to where I was, in terms of lost context. Hopefully, there's a fix soon and this can be avoided entirely.
on 2.1.69 in vs code. had this happen for the first time after dragging in an image from the Finder on macOS.
using /compact did not change anything.
abandoning session.
I got this today, for the first time, in the VS Code extension, on Mac.
I have a fairly new session with only a few prompts.
No images.
No warnings.
https://claude.ai/settings/usage indicates that I have plenty of usage left, both in my current session, and in weekly limits. Plus, I have "Extra usage" enabled.
Using version 2.1.70.
VERY FRUSTRATING.
I am facing the same issue. I tried different configurations and optimized Claude.md files. It started exploring files and hit this problem by itself as well.
We're all being told about this “genius finding tool,” but this bug makes it completely unusable.
A side-effect of this issue is that it wipes out any memory of the current conversation, such that, if you try to reload the conversation at a later time, all you get is "Prompt is too long". The rest of the conversation seems to be lost forever.
Also getting this, any fixes?
at least for me,, it turned out that my company proxy let me select the 1m token model, but the context was actually still limited to 200k, which is why my session would hit the token limit without warning me/compressing.
I want to figure out whether this bug is a client-side local error, or if it's actually accessing the remote model service and generating message based on the api error code?
Just got this too...really painful...no way to even summarize now to recover. Any update?
same issue it's too frustrating, prompt too long even though it's a word, and my usage isn't even close to limits. clearly an annoying regression
Please fix it otherwise have to workaround via the system prompt input file.
Additional evidence: image paste causes instant context overflow
Adding log-level evidence from a VS Code extension session (v2.1.42, Linux, Opus 4.6).
The specific trigger: pasting a screenshot
A single base64-encoded screenshot consumes ~334,000 tokens. The autocompact threshold is 167,000 with an effective window of 180,000. There is no pre-validation of image size before it's added to the conversation.
Timeline from extension logs (2026-04-16)
This happened 6 times in a single day across different sessions. The pattern is always the same: paste image → instant overflow → dead session.
Why autocompact can't help
Autocompact runs after the message is already in the conversation. When a single image is 2x the entire context window, there's nothing to compact — the one message alone exceeds the limit.
Suggested fix
Pre-validate image token cost before adding to conversation. If
current_tokens + image_tokens > effective_window, either:Related: #25683 (closed/stale, same bug), #23047, #42084, #8092, #49552 (my duplicate)
Same issue here on Claude Code desktop app.
Symptom: "Out of extra usage" error persists on desktop even after raising monthly spend limit from €150 → €400 and purchasing additional credits.
Workaround that works: Using Claude Code in browser instead of desktop app — works normally, same account, same model (Sonnet 4.6).
Account state when blocked:
Affects: production work with deadline, lost ~2h troubleshooting.
This started happening to me after updating to Version 1.5354.0 (9a9e3d)
"Prompt is too long" making sessions completely unusable is exactly what cozempic's treatment command was built for. It applies up to 18 pruning strategies to shrink the JSONL — compact-summary-collapse alone saves 85-95%.
pip install cozempic && cozempic treatto recover a broken session. https://github.com/Ruya-AI/cozempic — let me know if it helps.I ran into the same issue today. I started a fresh Claude Code session and screenshot-ed the broken "Prompt Too Long" session — it found that there were dozens of image attachments (base64-encoded screenshots) bloating the session JSONL. I asked it to fix it, with the trade-off that the old screenshots/PDFs won't be visible to Claude in that session anymore, but all text, tool results, decisions, and the parent-child message chain stay intact. If I need to reference an image again, I just re-attach the ones that are still relevant.
Also facing the same issue, my session contains important context and it's now no longer usable. I had to make a new session to continue.
My Claude has decided to use Codex now for subagents because of this bug. :)
<img width="1552" height="246" alt="Image" src="https://github.com/user-attachments/assets/8be66daf-cb06-454b-8a3e-c55a20553873" />
very annoying bug, there should never be a case where a session is not resumable
Had this happen with context at 300k/1M.
<img width="714" height="133" alt="Image" src="https://github.com/user-attachments/assets/11840755-d094-49aa-8261-ec19948b8d1e" />