[BUG] Prompt is too long (Claude for VS Code)

Resolved 💬 17 comments Opened Dec 31, 2025 by EntropyReversed Closed Apr 27, 2026
💡 Likely answer: A maintainer (claude[bot], contributor) responded on this thread — see the highlighted reply below.

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?

I lost my few weeks long session due to "Prompt is too long",
When i tired to run /compact I got this:
Error: Error during compaction: Error: Conversation too long. Press esc twice to go up a few messages and try again.

Then I started brand new session, and after literally 10 minutes I got exact same issue again

What Should Happen?

It should compact it by itself, and if it doesn't, /compact should work!

Error Messages/Logs

Steps to Reproduce

Start new session, give task to Claude, after 10 minutes "Prompt is too long" message pops up and compact is not working

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

2.0.76 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

VS Code integrated terminal

Additional Information

_No response_

View original on GitHub ↗

17 Comments

github-actions[bot] · 6 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/13889
  2. https://github.com/anthropics/claude-code/issues/14274
  3. https://github.com/anthropics/claude-code/issues/15058

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

derrikconrad95 · 6 months ago

I have been having the same thing happen. It only works in 1M context window.

Smoin1 · 6 months ago

for me it is the same. happens very often and then all ist totally lost. anothr bug which helps making claude unusable currently

github-actions[bot] · 5 months ago

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

CleverCoder · 5 months ago

Definitely still happening. Claude should resolve this silently, without user interaction. This occurred with my personal max account and a work / enterprise account. I even saw it with a new conversation.

Daniele-Gregori · 5 months ago

I also found today this issue still persists, but it looks as a problem merely of the interactive session, while fortunately all messages and conversation details are saved in /.claude/projects/ . I managed to find inside the subfolder of the project a 16 MB jsonl file which can be turned into a table of nearly 2400 rows and 34 columns. It will be a bit laborious to recover the messages I need, but perfectly possible in principle.

ghbaud · 5 months ago

This is definitely still a problem

manums · 5 months ago

this is happening even now. There is no deterministic repro, but this issue still bugs us.

ctsstc · 5 months ago

Auto compacting used to work just fine. Now it seems I keep running into this in Claude for VSCode. I'm trying out the newer CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS maybe it's related to that? I thought it was supposed to help with context bloat, but I keep hitting this issue over simple prompts. Also the VSCode extension doesn't always show the context window usage. If I try to run a manual compaction I get this:

Error: Error during compaction: Error: Conversation too long. Press esc twice to go up a few messages and try again.

As far as I know the "press esc twice" is a thing for the CLI which isn't relevant to the VSCode extension.

Yesterday when this happened I tried to open up the CLI and it couldn't find the session. Today when I open it up in the CLI I was able to find the session to try and resume it, but then I get:

I don't see any previous conversation context - it looks like the conversation compaction failed. Could you let me know what you'd like me to help you with?

It's frustrating to have just gone through a planning session, and right when it's about to start it's all gone.

Here's my ccusage for today for reference. This was my first prompt.

<img width="1036" height="205" alt="Image" src="https://github.com/user-attachments/assets/7c3fbac0-14b8-4204-b0f1-db57b3fb1c58" />

---

I did want to note that auto compacting seemed to take quite some time, and I don't remember there being any UI to display progress.

EntropyReversed · 4 months ago

This is totally unacceptable. This bug has been present for months and months. For a product that costs $200 per month, you would think they would have fixed it by now.

Anyway, the only way to make it work again in the same session after the “Prompt too long” message is to completely close VSCode. When you open it again, as soon as the Claude chat appears, paste “/compact”.

That’s the only way I was able to make it work.

jasonerivera · 4 months ago

I pick up where I left off at in a new session by telling it "find the most recent session I was working in before I got the 'prompt is too long' error." It will go out and find it then ask if you want to resume.

But I agree, this is an annoying bug that needs to be fixed for the price.

danielealbano · 4 months ago

The VSCode extension for Claude Code is just a joke, I am really thinking to switch to Cursor because I don't really have these weird issues and the product is definitely more curated.

Sure, it's a tad more expensive ... but paying for something broken that will not get fixed it's just non sense

OBugroviy · 4 months ago

Same issue. This occurs most frequently on 2.1.74 (Sonnet)

<img width="1748" height="1034" alt="Image" src="https://github.com/user-attachments/assets/674438ff-8e31-400a-a3e8-41bd89c25291" />

Udayakumarg · 2 months ago

Same issue exists - pasted a 1.3MB DB migration script. Claude Code accepted it silently, hit the Prompt is too long API error, and the entire session was lost.

Impact:
_15 days of maintained session context wiped. No warning, no recovery._

Root cause (likely):
Input size is not validated client-side before sending to API. The error only surfaces after the request is made, at which point the context window is already corrupted/dropped.

Suggested fix:
Validate input token estimate before appending to history. If over limit, reject with a clear message, don't silently poison the session.

claude[bot] contributor · 2 months ago

This is a duplicate of #2038, which was fixed as of version 2.1.85.

junaidtitan · 2 months ago

Losing a weeks-long session to "Prompt is too long" is devastating. Cozempic can recover these sessions — 18 pruning strategies strip stale tool outputs, old reads, images, and metadata. The guard daemon also prevents this by auto-pruning continuously before you hit the limit. pip install cozempic https://github.com/Ruya-AI/cozempic — happy to hear how it goes.

emeyer166-gif · 23 days ago

Yeah, I had the same issue, and it's very annoying. I just gave it a simple prompt to not remember any past chats. For me, it was adding a large file and not realizing it. After I asked it to forget the last chats and just use the files, it started working. Let me know if this helped.