← Claude Code Hub
✦ Tip #217 Oct 3, 2026

"Prompt is too long" in Claude Code: when /compact can't fix it

"Prompt is too long" in Claude Code comes in several versions, and some warn you that compacting won't help. What follows the · tells you which one you have.

Prompt is too long in Claude Code: what follows the · decides the fix; single exchange cannot be compacted, automatic compaction failed carries the reason, Context limit reached is fixed with /compact, and the bare error calls for updating to 2.1.288

TL;DR Read what follows the ·. If it says single exchange, there is nothing to summarize: /clear and start with less (smaller files, less pasted text). If it says automatic compaction failed, the reason is right there. If it's the bare error in the middle of a long session, update to 2.1.288 or later.

"Prompt is too long" shows up when what Claude Code sends (the conversation, the system prompt, the tools and the attachments) doesn't fit in the model's context window. Claude Code compacts on its own before it gets there, so seeing the error means compacting either wasn't possible or wasn't enough. Running /compact again doesn't fix all of those cases, and the message itself tells you which one you're in: the part that matters comes after the ·.

Result, two of the variants with the text Claude Code 2.1.284 prints (the numbers are examples):

Prompt is too long · the request is ~1048000 tokens (limit 1000000) and this
conversation's own content is most of it. A single-exchange conversation cannot
be compacted; start with less content (smaller files or pasted text).

Context limit reached · /compact or /clear to continue · auto-compact is off · /config to turn it on

The first one is telling you /compact won't help. The second one says it will, and why it didn't happen on its own.

What each variant tells you

What follows "Prompt is too long" or "Context limit reached" What happened What to do
· this conversation is a single exchange and cannot be compacted One exchange, and most of the weight is system prompt, tools or attachments Cut what every request loads: attachments, MCP servers, tools
· the request is ~N tokens (limit M) and this conversation's own content is most of it One exchange with a huge file or paste /clear and start with less: the excerpt that matters, not the whole file
· ... but this conversation is only ~S tokens One exchange, and the conversation is small next to everything else Drop attachments or tools, or start with less context
· automatic compaction failed: <reason> Claude Code tried to compact and failed Read the reason, which is spelled out (up to 300 characters)
Context limit reached · /compact or /clear to continue Context filled up and compaction is still available /compact, ideally with a focus: /compact keep only the plan and the diff
... · auto-compact is off · /config to turn it on Auto-compact is turned off Turn it on in /config so it doesn't happen again
Context limit reached · /clear to continue Compaction is disabled entirely (DISABLE_COMPACT) /clear, or unset that environment variable

Two more messages come back when you run /compact yourself, and they also save you from retrying:

  • Not enough messages to compact.: the conversation has fewer than two messages to summarize. It happens with a full context when a single paste filled it.
  • Conversation too long. Press esc twice to go up a few messages and try again.: the summary couldn't go through with the whole conversation. Esc Esc opens the rewind menu; step back a few messages and try again.

Why /compact used to fail on this

Part of the problem was bugs, fixed in recent releases. From the changelog:

  • 2.1.269: sessions stuck for good on "Prompt is too long" when auto-compact had no complete earlier exchange to summarize (mostly Agent SDK sessions with very large prompts).
  • 2.1.274: hook-driven sessions (an active /goal, for instance) ending on the error instead of compacting when the context overflowed again.
  • 2.1.281: a huge first prompt now gets summarized on its own instead of being left out of the summary.
  • 2.1.284: if the compacted request is still too long, Claude Code compacts once more, keeping less of the recent conversation. Before, the error stuck.
  • 2.1.288: long conversations failed with the error instead of auto-compacting when the last reply reported zero token usage.

If it hits you in an ordinary long session and the message has no suffix, check the version first.

How to get out

1. Read the suffix

What follows the · decides everything else. If nothing follows it, you're in the generic case: go to step 2.

2. Check your version and update

claude --version
claude update

Below 2.1.288 you're missing the fixes listed above.

3. If it's a single exchange, start over with less

/clear and ask again with the excerpt Claude needs, not the whole file. If the weight is in what every request loads, when Claude Code loads each feature tells you what to trim.

4. If it comes back after a /clear, see what fills the window

/context

If the Messages row is the largest, a file or a tool output is filling it again. If the other rows add up to more, what loads at startup leaves you no room to work. How to read /context.

To keep it from happening again: compact yourself at a natural break, with a focus, instead of waiting for the limit. What survives when you do is in what survives a /compact; to summarize only the start and keep the recent part intact, Summarize up to here; and if you suspect your auto-compact window isn't the model's own, who decides it.

Official docs: Error reference, Prompt is too long

Free guide

The 51 essentials, as a guide.

One page per tip. Five chapters. What I actually use daily in production. No theory, no fluff.

  • I. Getting started 10 tips
  • II. Awareness 3 tips
  • III. Mastery 22 tips
  • IV. Autonomy 10 tips
  • V. Comparison 6 tips
Are you a professional Web developer?

You'll receive the guide by email · You join the Gravitas newsletter · Unsubscribe anytime

of 51
#

Wmedia · 51 Tips
Free guide · 51 tips · 5 chapters

The 51 essentials, as a guide.

Are you a professional Web developer? · Unsubscribe anytime
Workshop for teams

Multiply your team's output without sacrificing quality: a 6 to 8 hour AI First workshop, online, on the Claude platform.

See the workshop

Want the 51 Claude Code essentials as a guide?