Originally published at its-tahir.com.

I tried to trigger Claude Code's "Prompt is too long" on purpose by pasting about 580K tokens. It didn't fail: Haiku 5.5's 1M-token window took it, and the run cost $0.92 at list price. Only an input over 1M tokens was blocked, locally, for $0. Here's every form the error takes on Claude Code 2.1.332 and what to do about each.

"Prompt is too long" in Claude Code means the request it was about to send (your conversation plus the system prompt, tool definitions, CLAUDE.md files and attachments) no longer fits the model's context window. Run /compact to summarise earlier turns, or /clear to start fresh, then /context to see what filled it. In an interactive session the same error reads Context limit reached · /compact or /clear to continue; in claude -p it stays Prompt is too long. Besides that interactive line, Claude Code has four variants that name the cause (auto-compact off, a single exchange, a failed compaction, Bedrock's wording), and each has a different fix.

What you see What it means Fix
Prompt is too long (in claude -p, the transcript or the SDK) The request is over the context window /compact, or /clear and resend less
Context limit reached · /compact or /clear to continue The same, in an interactive session Run one of the two; check auto-compact is on
... · auto-compact is off · /config to turn it on You turned auto-compact off Turn it back on in /config, or /compact yourself
Prompt is too long · this conversation is a single exchange and cannot be compacted One prompt is too big on its own /clear, then send smaller files or less pasted text
Prompt is too long · automatic compaction failed: <error> Compaction itself failed on another error Fix the named error first
Input is too long for requested model Amazon Bedrock's wording of the same limit Same fixes; update if you're older than 2.1.217
Not enough messages to compact. after /compact A single exchange: nothing earlier to summarise /clear and resend with less
Request too large (max 32MB)... A different limit: request size in bytes, not tokens See Prompt is too long vs Request too large

Last reviewed 26 November 2026, against Claude Code 2.1.332 on Windows 11. I read the error strings out of the 2.1.332 build's own text, and they match Anthropic's error reference. The two runs described below are my own, in claude -p with Haiku 5.5, on the same day.

Which Claude Code 'Prompt is too long' do you have? Context limit reached · /compact or /clear to continue: the interactive form, run /compact or /clear. · auto-compact is off · /config to turn it on: turn auto-compact back on. Prompt is too long · this conversation is a single exchange and cannot be compacted: /clear and send less. Prompt is too long · automatic compaction failed: fix the named error first. Input is too long for requested model: Bedrock's wording, same fixes. My test on 2.1.332: over 1M tokens was blocked locally at $0; 580K tokens fit Haiku 5.5's 1M window and cost $0.92.

Five ways Claude Code says your request doesn't fit, and the first thing to do for each.

What does "Prompt is too long" mean in Claude Code?

It means the full request is bigger than the model's context window, the number of tokens the model can take in at once. The request isn't just what you typed: Claude Code sends your whole conversation plus its system prompt, the definitions of every tool and MCP server you have loaded, your CLAUDE.md and rules files, and any attached files or pasted text. Any of those can push it over.

Claude Code checks the size itself before sending, and stops the turn when it already knows the request won't fit. When it doesn't know (behind a gateway, for example, or when its own estimate is off), the API rejects the request and Claude Code shows the same error. Either way, auto-compact normally steps in first and summarises older turns, so in a long session you usually see this error only when auto-compact is off, when compaction itself failed, or when a single prompt is too big to fit at all.

How do I fix "Prompt is too long" in Claude Code?

Run /compact to summarise earlier turns or /clear to start fresh, then run /context to see what filled the window and cut the biggest part: unused MCP servers, a large CLAUDE.md, or pasted files.

  1. /compact summarises earlier turns and keeps the session. Add a focus to keep what matters, like /compact keep the plan and the failing test.
  2. /clear starts fresh. Use it if /compact says Not enough messages to compact., then resend with less pasted text or smaller files.
  3. /context shows what's using the window: system prompt, tools, MCP tools, memory files and messages. Fix the biggest row.
  4. MCP tools large? Disable servers you aren't using with /mcp disable <name>; their tool definitions are sent with every request. Why Claude Code uses so many tokens shows how much they add.
  5. Memory files large? Trim CLAUDE.md, or move instructions into path-scoped rules that load only for matching files. If you keep both CLAUDE.md and AGENTS.md, check which one actually loads in Claude Code and AGENTS.md.
  6. Messages large? Stop pasting big files and logs; give Claude the path so it reads a range, or send large-file work to a subagent, which has its own context window.
  7. Auto-compact off? Turn it back on with Auto-compact in /config, or unset DISABLE_AUTO_COMPACT. If you keep it off, run /compact yourself before the window fills.
  8. Stopped Claude while it was compacting? Your conversation is unchanged and still too big: run /compact and send again. Updating to 2.1.304 or later stops that case from ending the turn with this error.

My Prompt is too long error page on tools.its-tahir.com has the same fixes as a short checklist.

Why does Claude Code say "Context limit reached · /compact or /clear to continue"?

It's the interactive version of "Prompt is too long": the conversation no longer fits, and Claude Code is asking you to make room.

Context limit reached · /compact or /clear to continue 

/compact summarises the earlier conversation and keeps going. /clear starts a new conversation in the same session. If you've set DISABLE_COMPACT, the line names only /clear.

Auto-compact is on by default and normally compacts before you get here, so when this line appears, check whether it's off. If you turned it off with the Auto-compact toggle in /config, the line says so:

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

The hint appears only when /config can actually change it. If auto-compact is off through DISABLE_AUTO_COMPACT, DISABLE_COMPACT, or a project or managed setting, you get the line without the hint, and you'll need to change that variable or setting instead. If it's on and still compacting at odd points, Claude Code keeps compacting covers that side.

What does "this conversation is a single exchange and cannot be compacted" mean?

Your conversation has only one exchange, so there's nothing earlier to summarise: that one prompt, plus what Claude Code sends with it, is already over the limit. Compaction can't help, so Claude Code skips it and tells you where the size comes from. The 2.1.332 build has three versions of the message.

When the API didn't report token counts:

Prompt is too long · this conversation is a single exchange and cannot be compacted — the request size comes mostly from system prompt, tool definitions, or attachments. 

When your own content is most of the request (a pasted log, a huge file):

Prompt is too long · the request is ~<tokens> tokens (limit <limit>) 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). 

When most of the request is outside the conversation (tools, MCP servers, memory files, attachments):

Prompt is too long · the request is ~<tokens> tokens (limit <limit>) but this conversation is only ~<tokens> tokens — the rest is system prompt, tool definitions, and attachment content. A single-exchange conversation cannot be compacted; reduce attached files/tools or start with less context. 

The fix follows the wording. For "own content", run /clear and send less: point Claude at the file's path instead of pasting it, so it reads a line range, or split the log. For "the rest is system prompt, tool definitions", the overhead is the problem: disable MCP servers you don't need with /mcp disable <name>, and trim big CLAUDE.md files (see the fixes above). /compact answers Not enough messages to compact. in this state, for the same reason.

What does "Prompt is too long · automatic compaction failed" mean?

Auto-compact tried to make room, and the compaction request itself failed on a different error, which the message names after the colon.

Prompt is too long · automatic compaction failed: <the underlying error> 

Fix the named error first, because /compact fails on it too until you do. Typical ones are an unavailable model, an expired sign-in or a network problem; Claude Code not logged in or login expired and the 529 overloaded error cover two of them.

Behind a custom ANTHROPIC_BASE_URL, this form can also mean Claude Code assumed the wrong context window for your model ID. Anthropic's docs say to set the model's real context window, or update to 2.1.299 or later, which stopped ending the turn near an assumed 200K window.

If the error came after auto-compaction failed several times in a row, update: 2.1.332 fixed that case (see recent fixes).

Why do I get "Input is too long for requested model"?

That's Amazon Bedrock's wording for the same context limit, and Claude Code treats it exactly like "Prompt is too long". Auto-compact triggers on it and /compact works. Before 2.1.217 Claude Code didn't recognise the Bedrock wording, so auto-compact never fired and /compact failed with the same error; if that's what you see, update. A Claude apps gateway reports it as capability_rejected: prompt_too_long, which Claude Code has handled the same way since 2.1.228.

How big is Claude Code's context window?

1M tokens by default on current models, and 200K on older ones or when you turn 1M off. From Anthropic's model configuration docs, checked 26 November 2026:

Model Context window in Claude Code
Fable models (Anthropic's newest family, including Fable 5.2), Sonnet 5 and later, Haiku 5.5, Opus 4.7 and later 1M by default, no [1m] suffix needed
Opus 4.6, Sonnet 4.6 200K; 1M only with the [1m] variant (/model opus[1m]), which depends on your plan
Any model with CLAUDE_CODE_DISABLE_1M_CONTEXT=1 set Treated as 200K
A model ID Claude Code doesn't recognise (a gateway alias) Whatever window it assumes; set the real one if it's wrong

On 1M models, auto-compact runs at about 967K tokens unless you set a smaller window with /autocompact, autoCompactWindow or CLAUDE_CODE_AUTO_COMPACT_WINDOW. A bigger window isn't free: Haiku 5.5 costs more per token on prompts over 100K tokens, according to the same page, and every token in a long conversation is re-sent on each turn. If your gateway rejects requests over 200K, set CLAUDE_CODE_AUTO_COMPACT_WINDOW=200000 so sessions compact at that boundary instead of failing.

Does "Prompt is too long" cost anything?

A request Claude Code blocks locally costs nothing, but anything that fits the model's window is sent and processed in full, even if you meant it to be too big. In my test, 579,934 input tokens on Haiku 5.5 cost $0.92 at list price; an input over 1M tokens was blocked for $0.

I ran two tests on 26 November 2026 with Claude Code 2.1.332 in headless mode (claude -p, --model haiku, which resolved to Haiku 5.5), piping in a large text file and asking a one-line question about it.

Run Input What Claude Code did Cost reported
1 About 1.3 million characters of filler words: 579,934 input tokens, per the run's modelUsage Sent it and the full input was processed, but the reply was refused ("stop_reason": "refusal"), for a reason I didn't determine; nothing points to the size $0.92 at list price
2 About 5.5 million characters of this blog's own posts, an estimated 1.4 million tokens (no count reported, because nothing was sent) Stopped it locally after about 1 second: Prompt is too long $0, 0 tokens, 0 ms of API time

Run 2 is the error itself. These fields are copied from its JSON result:

{ "result": "Prompt is too long", "terminal_reason": "blocking_limit", "duration_api_ms": 0, "total_cost_usd": 0, "is_error": true } 

Claude Code knew the request couldn't fit and never sent it, so it cost nothing. The transcript recorded the same message and no detail, because there was no API response to take token counts from.

Run 1 is the lesson. I sized it to be "too long" for a 200K model, but Haiku 5.5 runs with a 1M window on every plan, and Claude Code's own result reported "contextWindow": 1000000 for it. So the request went through, the whole input was processed, and Claude Code reported $0.92 at list price. claude -p reports that figure on a subscription too; the usage counts against your plan's limits rather than appearing on a bill. Most current models have the 1M window, so a paste that "obviously won't fit" often does fit, and you pay for it. Check the size first (see how to check).

How do I check my context usage in Claude Code?

Run /context: it breaks the window down into system prompt, tools, MCP tools, memory files and messages, shows which CLAUDE.md files loaded, and suggests what to cut. When the conversation has already grown past the limit, it opens with a warning such as:

Context exceeds the 200k-token limit by 94k tokens — run /compact or /clear to continue. 

With auto-compact on, you can just send your next message and let it compact. A different line, Context is 94k tokens past the 200k-token compaction window — run /compact to reduce usage., means you've passed your compaction window, not the model's limit, so requests can still succeed.

To check a file or log before you paste it, a token counter or a context window checker gives you the size in seconds. For VS Code, the changelog bundled with the 2.1.332 build lists two changes: a notice before you send a very large selection or attached text file, and advice under "Prompt is too long" that names the large part.

What is the difference between "Prompt is too long" and "Request too large"?

"Prompt is too long" counts tokens against the context window; "Request too large" counts bytes against the API's 32MB limit on the request body. You can hit the second with a conversation that's well under the token limit, usually from images, PDFs or big pasted content:

Request too large (max 32MB). Accumulated images and attachments in the conversation pushed the request over the limit. Run /compact, or double press esc to go back and remove attachments. 

/compact drops accumulated images and attachments, so it fixes most cases. If the message says compacting cannot make it fit, press Esc twice to step back past the turn that added the content, or run /clear.

Is it the same error in the Claude app?

Not exactly: chats on claude.ai and in the Claude apps also stop at the model's context window, but they have no /compact or /context, so the way out there is a new chat. This post is about Claude Code; I didn't test the apps' wording.

Recent fixes for "Prompt is too long"

Version What changed
2.1.162 A single-exchange conversation no longer tries a compaction that can't work; it explains what fills the request
2.1.217 Bedrock's Input is too long for requested model recognised, so auto-compact triggers on it
2.1.228 A Claude apps gateway's capability_rejected: prompt_too_long recognised
2.1.229 A failed automatic compaction names its cause after automatic compaction failed:
2.1.235 Context limit reached says when auto-compact is off and how to turn it on
2.1.269 Compaction no longer fails every turn when it can't summarise a whole exchange
2.1.299 Behind a custom base URL, no longer ends the turn near an assumed 200K window
2.1.304 Stopping Claude mid-compaction no longer ends the turn with this error
2.1.306 With many MCP tools, this error no longer hides an unrelated 400 or 422 from the API
2.1.332 Turns no longer end in "Prompt is too long" after repeated auto-compaction failures when one more could have worked

Versions before 2.1.332 come from Anthropic's Claude Code error reference (accessed 26 November 2026); 2.1.332 comes from the Claude Code changelog. Run claude update to get the latest.

Key takeaways

  • 'Prompt is too long' means the whole request (conversation, system prompt, tools, CLAUDE.md, attachments) is over the model's context window. Interactive sessions show it as 'Context limit reached · /compact or /clear to continue'.
  • Run /compact to summarise, or /clear to start fresh. If /compact says 'Not enough messages to compact.', it's a single exchange: /clear and send less.
  • The longer forms tell you the cause: 'single exchange' means one prompt is too big, 'automatic compaction failed:' means fix the named error first, and 'auto-compact is off' means turn it back on in /config.
  • Most current models have a 1M window in Claude Code, so a big paste often fits and is processed and charged: my 580K-token test on Haiku 5.5 cost $0.92 at list price, while an over-1M input was blocked locally for $0.
  • /context shows what fills the window. Disable unused MCP servers, trim CLAUDE.md, and give Claude file paths instead of pasting files.

FAQ

When the session isn't failing but compacting more than it should, Claude Code keeps compacting and compacted while idle cover the two common causes, and every other error is in the full list of Claude Code errors and fixes. Keeping coding agents within their context and cost budget is part of the work I do: see recent projects.

FAQ

What does "Prompt is too long" mean in Claude Code?

It means the request Claude Code was about to send, your conversation plus the system prompt, tool definitions, CLAUDE.md files and attachments, is bigger than the model's context window. Claude Code either stops it locally before sending or gets it back from the API as an error. In an interactive session the same condition shows as 'Context limit reached · /compact or /clear to continue'; in claude -p output and the transcript it stays 'Prompt is too long'.

How do I fix "Prompt is too long" in Claude Code?

Run /compact to summarise earlier turns, or /clear to start fresh. If /compact answers 'Not enough messages to compact.', the conversation is a single exchange: run /clear and resend with less pasted text or smaller files. Then run /context to see what fills the window, disable MCP servers you don't use with /mcp disable , trim large CLAUDE.md files, and reference big files by path so Claude reads them in chunks.

Why does Claude Code say "Context limit reached · /compact or /clear to continue"?

That is the interactive form of 'Prompt is too long': the conversation no longer fits the model's context window. Auto-compact normally prevents it, so if you see it, check whether auto-compact is off; the line then ends with '· auto-compact is off · /config to turn it on'. Run /compact or /clear, and turn auto-compact back on in /config.

What does "this conversation is a single exchange and cannot be compacted" mean?

Your conversation has only one exchange, so there is nothing earlier to summarise, and compaction can't make room. Claude Code then tells you what fills the request: your own content (start with smaller files or less pasted text) or the system prompt, tool definitions and attachments (reduce attached files and MCP tools, or start with less context). Run /clear and resend something smaller.

What is Claude Code's context window size?

1M tokens by default on the Fable models, Sonnet 5 and later, Haiku 5.5, and Opus 4.7 and later, per Anthropic's model configuration docs; they auto-compact at about 967K tokens. Opus 4.6 and Sonnet 4.6 have 200K unless you pick their [1m] variant, and CLAUDE_CODE_DISABLE_1M_CONTEXT=1 holds every model at 200K. In my test, Claude Code reported a 1,000,000-token context window for Haiku 5.5.

Does "Prompt is too long" cost usage?

Not when Claude Code blocks the request locally: my over-limit test reported 0 tokens, $0 and no API time. But an input that fits a 1M window is sent and processed in full. A 579,934-token input I meant to be too big was accepted by Haiku 5.5 and cost $0.92 at list price, so check size with /context or a token counter before pasting a huge file.

What is the difference between "Prompt is too long" and "Request too large"?

'Prompt is too long' is about tokens against the model's context window. 'Request too large' is about the raw request body passing the API's 32MB limit before tokenization, usually from images, PDFs or big pasted content. /compact helps with both unless the message says compacting cannot make it fit; then step back with Esc twice or run /clear.

Why do I get "Input is too long for requested model" in Claude Code?

That is how Amazon Bedrock words the same context limit error, and Claude Code handles it like 'Prompt is too long': it auto-compacts and /compact works. Before 2.1.217 Claude Code didn't recognise the Bedrock wording, so auto-compact never triggered on it. Update Claude Code if you're on an older version.

Sources

Originally published at its-tahir.com.