[BUG] Github Issue Prompt Too Long

Open 💬 42 comments Opened Feb 5, 2026 by cheizdo2-art

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

  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"
  1. Emergency Recovery Command
  • Add /recover command that works even when context is full
  • Auto-summarizes and clears old context
  • Preserves last 20-30 messages
  1. 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
  1. Smart Context Pruning
  • Remove redundant information automatically
  • Keep: decisions, code changes, important findings
  • Remove: intermediate debugging, repeated reads
  1. 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

.

View original on GitHub ↗

42 Comments

pleskyjp · 5 months ago

I do have timed out prompts too => Fixed locally

github-actions[bot] · 5 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/22013
  2. https://github.com/anthropics/claude-code/issues/22381
  3. https://github.com/anthropics/claude-code/issues/16697

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

giandre · 5 months ago
I do have timed out prompts too => Fixed locally

@pleskyjp , how did you fix this locally? I am having this problem constantly.

Alexander96f · 5 months ago

got the same issue, anyone got a solution for this? basicly its unuseable for me even in new conversation I get the same error

hansheng654 · 5 months ago

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 !!!!

mognog · 5 months ago

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:

  • no images
  • only had 3 very short text inputs from me
  • had to read a 30 line script
  • had to update an 800 line help markdown document

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" />

alexjcampbell · 5 months ago

How is this not a P0 for the Claude Code team? The product is barely usable.

pleskyjp · 5 months ago
> I do have timed out prompts too => Fixed locally @pleskyjp , how did you fix this locally? I am having this problem constantly.

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

eduwass · 5 months ago

Happening here too.. super annoying breaks workflow totally 😢

mognog · 5 months ago

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.

KrunchMuffin · 5 months ago

Just happened to me first time ever.

alexjcampbell · 5 months ago

Posting screenshots seems to be the thing that provokes this error consistently.

alexjcampbell · 5 months ago

@bcherny any prospect of this being fixed? It's so bad, it's got me using Cursor again :-/

Go-Pomegranate · 5 months ago

+1

MartinMachl · 5 months ago

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.

hunsnowboarder · 4 months ago

i got this only today, but it is super annoying. makes the product unusable.

mbhillrn · 4 months ago

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.

jokerit · 4 months ago

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.

alexjcampbell · 4 months ago

I got this again today on 2.1.58. Absolutely wild that this is not fixed after all this time.

saadharis · 4 months ago

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.

plantpurecode · 4 months ago

I started getting this error today as well.

johnmizz · 4 months ago

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.

srikar161720 · 4 months ago

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.

nabosh · 4 months ago

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.

TheRealMikeD · 4 months ago

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.

denyskotsur · 4 months ago

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.

TheRealMikeD · 4 months ago

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.

paulreichling · 4 months ago

Also getting this, any fixes?

Hallohannes123 · 4 months ago
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.

LuckyStar337 · 3 months ago

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?

taicho · 3 months ago

Just got this too...really painful...no way to even summarize now to recover. Any update?

dreevo · 3 months ago

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

weidonglian · 3 months ago

Please fix it otherwise have to workaround via the system prompt input file.

Postmanplayx · 3 months ago

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)

23:43:15 — User sends text message
           autocompact: tokens=17,616 (post-compact session, healthy)
23:43:19 — User pastes a PNG screenshot
23:44:19 — autocompact: tokens=351,512 (jumped 17K → 351K from ONE image)
23:44:19 — ERROR: "Conversation too long. Press esc twice..."
           Session permanently dead.

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:

  1. Reject with a clear message: "Image too large (estimated ~334K tokens, limit ~180K). Please resize."
  2. Auto-resize the image to fit within the remaining context budget
  3. Trigger a compact before adding the image

Related: #25683 (closed/stale, same bug), #23047, #42084, #8092, #49552 (my duplicate)

sharpfont · 2 months ago

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:

  • Weekly all models: 69% used
  • Sonnet only: 2% used
  • Monthly spend limit: €400
  • Available extra usage balance: yes

Affects: production work with deadline, lost ~2h troubleshooting.

wilkinsantana · 2 months ago

This started happening to me after updating to Version 1.5354.0 (9a9e3d)

junaidtitan · 2 months ago

"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 treat to recover a broken session. https://github.com/Ruya-AI/cozempic — let me know if it helps.

trinanda · 2 months ago

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.

hariskhan14 · 2 months ago

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.

ntotten · 2 months ago

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" />

Clockworkx · 1 month ago

very annoying bug, there should never be a case where a session is not resumable

KernelBypass · 1 month ago

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" />