Omniscio

OmniscioGuidesClaude Code context errors

Claude Code prompt is too long: what each context message means

Claude Code stops a request when the conversation no longer fits the model's context window, and the line it prints depends on which limit you crossed and which command frees it. This page lists the context messages, what each one means, and the steps that clear it. Every message and every step rests on Anthropic's own documentation, or on the report where a user raised it, and each section names the source it rests on.

Sources read October 23, 2026. By the Omniscio team. Updated .

Which message did you see?

Search the page for a few words of the line you saw, or pick it from this list. The wording moves between releases, so the same condition can print differently on two versions, and Anthropic's error reference keeps a note for each change.

Prompt is too long

Prompt is too long
Input is too long for requested model.
capability_rejected: prompt_too_long

What it means. The conversation plus the files attached to it has grown past the model's context window. An interactive session shows the same error as the Context limit reached line with the two commands that free space. Amazon Bedrock reports the condition as Input is too long for requested model., and a Claude apps gateway reports it as capability_rejected: prompt_too_long when a cloud upstream rejects the request in the provider's own error shape. Claude Code treats the Bedrock wording and the gateway token the same as its own. Before v2.1.217 it did not recognize the Bedrock line, and before v2.1.228 it did not recognize the gateway token, so auto-compact never triggered on either.

Two details change what the line itself says. When DISABLE_COMPACT is set to 1, all compaction is off, both the automatic pass and the manual command, and the line then names only /clear. When you turned auto-compact off in /config, the line says so and names /config to turn it back on. That hint appears only while a /config change would take effect: it does not appear when DISABLE_AUTO_COMPACT or DISABLE_COMPACT turned compaction off, or when a higher-precedence settings scope set autoCompactEnabled to false. Before v2.1.235 the line carried no hint at all.

What to do

  1. Run /compact to summarize earlier turns and free space, or /clear to start fresh.
  2. Run /context for a breakdown of what is consuming the window: the system prompt, tools, memory files and messages.
  3. Disable MCP servers you are not using with /mcp disable <name>, so their tool definitions leave context.
  4. Trim large CLAUDE.md memory files, or move instructions into path-scoped rules that load only when relevant.
  5. Auto-compact is on by default and normally prevents this error. If you turned it off in /config or with DISABLE_AUTO_COMPACT, turn it back on. If you keep it off, run /compact yourself before the window fills.
  6. If /compact answers Not enough messages to compact., the conversation is a single exchange with nothing earlier to summarize. That section covers it.
  7. If the error appears near 200K tokens on a model that accepts more, one cause is a model ID Claude Code does not recognize. It assumes a 200K window for such an ID, so set the model's real context window to keep working past that point.
  8. If the error appeared right after you stopped Claude while it was compacting, the conversation is unchanged and still needs compacting. Run /compact, send your message again, and update to v2.1.304 or later. Before v2.1.304, stopping at that moment could end the turn with this error.
  9. On v2.1.305, with many MCP tools and a direct connection to the Anthropic API, this error can hide an unrelated 400 or 422 error from the API. Update to v2.1.306 or later to see the original error.

Where we read this

The messages and the steps come from Anthropic's error reference, read on October 23, 2026, including the Bedrock and gateway wordings and the version notes behind them. The DISABLE_COMPACT wording comes from Anthropic's environment variable reference, the auto-compact toggle and the hint behind it from the settings reference, and the assumed window for an unrecognized model ID from the model configuration page, all read the same day.

Context limit reached

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

What it means. This is how an interactive session prints Prompt is too long, so the cause is the same one: the conversation and its attached files have filled the model's context window. The second line adds that auto-compact is off, and it carries the hint only while a /config change would take effect. The longer forms of the error keep the Prompt is too long · wording, so a compaction that failed shows the compaction line rather than this one, and the text stays Prompt is too long in -p output and in the transcript.

With DISABLE_COMPACT set to 1, this line names /clear and not /compact, because the manual command is off too. Before v2.1.235 the line carried no auto-compact hint.

What to do

  1. Run /compact to summarize earlier turns and free space, or /clear to start fresh.
  2. Run /context to see which categories make up the used total before you choose between them.
  3. If the line names /config, turn the Auto-compact toggle back on there. It is on by default, and the manual command keeps working while it is off.
  4. If you keep auto-compact off, run /compact yourself before the window fills next time.

Where we read this

The line and the steps behind it come from Anthropic's error reference, the auto-compact toggle and the settings precedence that decides when the hint appears from the settings reference, and the DISABLE_COMPACT wording from the environment variable reference, all read on October 23, 2026.

Context exceeds the token limit

Context exceeds the 200k-token limit by 94k tokens — run /compact or /clear to continue.
Context is 94k tokens past the 200k-token compaction window — run /compact to reduce usage.

What it means. This is the warning /context shows at the top of its output once the conversation has grown past the model's context window, and requests fail with Prompt is too long until you free space. The second form is the one for a compaction window, such as the 200K boundary on a 1M-context model. A compaction window can sit below the model's whole window, so requests past it can still succeed. Both forms name /clear instead of /compact when DISABLE_COMPACT is set, and both quote figures for the session they came from, so the numbers on your screen will differ.

What to do

  1. In a multi-turn conversation, run /compact to summarize earlier turns and free space.
  2. Run /clear instead when you mean to start fresh.
  3. On a 1M-context model, carry on rather than clearing: the 200K line is the compaction window there, and a request past it can still succeed.
  4. For more ways to reduce usage, work through the steps under Prompt is too long.

Where we read this

Both warnings and the steps come from Anthropic's error reference, and the command's own description from the commands reference: /context visualizes current context usage, and its output includes a warning showing how far over the limit you are and which command frees space. Read on October 23, 2026, including the note on versions before 2.1.216, where /context showed usage above 100% with no warning line.

Automatic compaction failed

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

What it means. Automatic compaction ran on this turn and failed on an underlying error, such as an unavailable model or an authentication failure, and the message names that error after the separator. The conversation is unchanged, so the window is still full. Resolve the named error first, because /compact fails on the same error until you do. Before v2.1.229, a failed automatic compaction surfaced Prompt is too long without the cause.

It helps to know what the pass was doing when it failed. When automatic compaction runs, it normally summarizes your oldest exchanges and keeps the newest. As a last resort, when it cannot summarize any whole exchange, Claude Code keeps your newest prompt word for word and summarizes everything before it; and when the conversation does not end with your prompt, it summarizes the whole conversation instead. It skips that recovery when what it would carry forward holds no model reply and less than about 1,000 tokens of your own text, such as a short retry sent after an oversized paste. Before v2.1.269, compaction failed whenever it could not summarize a whole exchange, so a session in that state hit this error again on every turn.

What to do

  1. Read the error named after automatic compaction failed: and fix that first. /compact fails on the same error until you do.
  2. If the named error is an authentication failure or an unavailable model, correct it and send your message again. The conversation is still there.
  3. If the conversation is also a single exchange with nothing to summarize, that section has the recovery that fits.
  4. Update Claude Code. Before v2.1.229 the message hid the cause, and before v2.1.269 a conversation that could not be summarized failed on every turn.
  5. On a custom ANTHROPIC_BASE_URL, when this message appears near 200K tokens, set the model's context window, or update to v2.1.299 or later. Before v2.1.299, Claude Code ended the turn with this message near the assumed 200K window instead of sending the request.

Where we read this

The message, the last-resort summary behaviour and every version note come from Anthropic's error reference, read on October 23, 2026.

This conversation is a single exchange

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

What it means. A single-exchange conversation has no earlier turns to summarize, so Claude Code skips the compaction attempt and explains what fills the request instead. That is why there are three of these lines rather than one. The first is what you see when the API does not report token counts. The other two appear when it does: Claude Code compares those counts with its own estimate of the conversation's size to tell whether the conversation's own content is most of the request, or whether the system prompt, tool definitions and attachments are. The figures in the last two lines are quoted for the session they came from, so yours will differ.

What to do

  1. Start with less content. Smaller files, or only the part of a file you need pasted in.
  2. Reduce attached files and tool definitions, because those are sent with every request whether or not the conversation is long.
  3. Run /clear and send the prompt again with less pasted text or a smaller attachment.
  4. Run /context to see how much of the window the system prompt, tools and memory files take before you type anything.

Where we read this

The three lines and the recovery come from Anthropic's error reference, read on October 23, 2026, including the note that before v2.1.162 Claude Code attempted the compaction anyway and surfaced the bare Prompt is too long when it failed.

Request too large, and an image that was too large

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.
Request too large (max 32MB; 20.1MB of about 33.4MB is images or documents).
Image was too large. Double press esc to go back and try again with a smaller image.
API Error: an image in the conversation could not be processed and was removed.

What it means. Request too large is about the raw request body, which passed the API's 32MB limit before tokenization, usually because of large pasted content, tool results or attachments. That limit is separate from the context window, so a conversation well inside its window can still fail here. When the message names a figure such as 20.1MB of about 33.4MB is images or documents, images or documents pushed the request over, and Claude Code retries with them stripped. Through a proxy, a gateway or a cloud provider you get the general wording instead of the measured one, and the fix is the same. Image was too large is about one attachment: a pasted or attached image went past the API's size or dimension limits. The could not be processed and was removed line means the API refused an image that was already in the conversation.

Before v2.1.212, conversations with enough accumulated images failed on every turn. Before v2.1.229, Claude Code showed the attachment advice for every rejection, even when compacting could not help. Both of those are fixed by updating.

What to do

  1. Run /compact. It drops accumulated images and attachments.
  2. When the message says compacting cannot make it fit, the messages alone are over the limit. Press Esc twice to step back past the turn that added the large content, or run /clear to start fresh.
  3. Reference large files by path instead of pasting their contents, so Claude reads them in chunks as it needs them.
  4. Resize an image before pasting it. The API accepts images up to 8000 pixels on the longest edge for a single image, or 3000 pixels when more than 20 images are in context.
  5. If an image error keeps coming back, update Claude Code. Before v2.1.299, in a long conversation with many images, Claude Code could remove the images you attached last instead of the one over the limit, and images attached while Claude was working reached the API at their original size. Before v2.1.166, a pasted image could stay in the conversation and the same error then repeated on every message.

Where we read this

The request-size message, the measured forms and the advice under them come from Anthropic's error reference, and the image limits and version notes from the image section of the same page. Read on October 23, 2026.

No complete prefix fits within the image limits

You may have arrived here holding a line that reads Cannot compact this conversation: no complete prefix fits within the image limits and reserved summary space. Anthropic's Claude Code documentation carries no such message, and we found no Anthropic source that prints it. The wording matches LM Studio's, reported as issue 2482 in its bug tracker: a local session cannot compact because its tool results carry images. LM Studio's case is its own. Nothing on this page attributes that line to Anthropic.

If you saw that line in LM Studio, that issue is where to follow it. If you saw a similar line while using Claude Code, the two sections that fit are This conversation is a single exchange, which is a compaction that cannot run because there are no earlier turns to summarize, and Automatic compaction failed, which is a compaction that ran and failed.

Where we read this

The line, the app and the version behind it come from LM Studio bug tracker issue 2482, opened against Bionic 1.1.7 with a Qwen3-VL-32B model running over LM Link. Anthropic's error reference, read the same day, October 23, 2026, carries no message of that shape.

Keeping the window from filling

Claude Code compacts automatically as you approach the limit, so a full context window does not end your session. Without a window of your own it compacts when the conversation reaches the model's context limit, except in a few sessions: cloud sessions compact as the conversation approaches the model's limit; Sonnet 4.6 and Opus 4.6 without extended context compact at the 200K boundary; models running with a native 1M window compact at about 967K tokens by default; and a session on a model ID Claude Code does not recognize compacts at the window it assumes for that ID.

Five things you can do before that pass runs:

  • Compact with a focus: /compact with instructions, such as /compact focus on the auth bug fix, so the summary keeps what you choose rather than what the automatic pass guesses matters.
  • Compact part of the conversation: run /rewind, pick a message, and choose Summarize from here or Summarize up to here.
  • Compact earlier: /autocompact <tokens> sets how full the window gets before the automatic pass runs. It takes a size such as 500k, or auto to return to the window tuned for your model. Claude Code saves the value to user settings and applies it to the current session. It needs v2.1.221 or later.
  • Clear between tasks: run /clear when you switch to unrelated work, because an old conversation crowds out the files you need next and costs tokens on every message.
  • Delegate large reads: send research to a subagent, so the file contents stay in its context window rather than yours.

The same number lives in settings as autoCompactWindow, which takes a token count from 100000 to 1000000, is capped at your model's context window, and is unset by default so Claude Code picks a window tuned for your model. --autocompact takes precedence over that key for one session, and CLAUDE_CODE_AUTO_COMPACT_WINDOW takes precedence over both.

autoCompactEnabled is the key behind the Auto-compact toggle in /config. The manual /compact command keeps working while auto-compact is off, and turning auto-compact off turns idle compaction off too. Between the two commands: /compact [instructions] frees context by summarizing the conversation so far, with optional focus instructions, and /clear [name] starts a new conversation with empty context and can label the previous one in the /resume picker. To free space while continuing the same conversation, use /compact.

If you need a larger window rather than a smaller conversation, the Fable models, Sonnet 5 and later, Haiku 5.5, Opus 4.6 and later, and Sonnet 4.6 support a 1 million token context window, and compaction works the same way at the larger limit.

After a compaction these things survive: the project-root CLAUDE.md and unscoped rules are re-injected from disk, auto memory is re-injected, the system prompt and the output style still apply, and Claude Code re-reads up to five of the files it read or edited, most recently modified first. A file over 5,000 tokens comes back as a path reference without its content.

What does not help

  • Turning auto-compact off in /config does not keep the error away. The automatic pass is what normally prevents it, and with auto-compact off you have to run /compact yourself before the window fills.
  • /clear is not a smaller /compact. It starts a new conversation with empty context, so nothing from the old one comes back.
  • A larger context window does not help with Request too large (max 32MB). That limit applies to the raw request body before tokenization, and it is separate from the context window.

Where we read this

The automatic pass, the five options before it, the 1M-token models and what survives a compaction come from Anthropic's context window page; the default thresholds per model and the window assumed for an unrecognized ID from the model configuration page; /autocompact, /compact and /clear from the commands reference; and autoCompactEnabled with autoCompactWindow from the settings reference. All read on October 23, 2026.

Watching the window across many sessions

Omniscio is the desktop app we make for running many Claude Code sessions at once, and the context window is one of the things it keeps in front of you. The Context Details popover breaks down what is filling a session's window right now: a summary row of used tokens against the maximum, the categories that make up the used total, and expandable per-source sections, as the Context Details page in our library describes it. It opens from the session's three-dot menu, and an optional donut-ring indicator in the header shows the same figure at a glance, off by default. Out-of-context stall recovery is on by default, and the library page for stall recovery sets out the whole of it: when a turn ends with the context window near full and the agent did not ask a question, is not parked waiting, and did not already deliver its final answer, the app sends a "Please continue" nudge so the CLI compacts and the agent finishes the thought. It is bounded, so after a few nudges that free no room it stops, posts a note and drops the session into your inbox. The features page lists the rest of it, and the download page has the installers.

Sources

Every message, meaning and step on this page rests on one of these. The date beside each one is the day we read it.

  • Claude Code error reference, for the Prompt is too long message, the Context limit reached lines, the compaction failure, the single-exchange lines, the /context warning, and the request-size and image messages, with the steps and version notes under each. Read October 23, 2026.
  • Explore the context window, for the automatic pass, the options before it, the 1M-token models and what survives a compaction. Read October 23, 2026.
  • Commands reference, for /context, /compact, /clear, /autocompact, /rewind and /mcp disable. Read October 23, 2026.
  • Settings reference, for the Auto-compact toggle behind autoCompactEnabled, for autoCompactWindow, and for the precedence that decides when the auto-compact hint appears. Read October 23, 2026.
  • Model configuration, for the compaction thresholds by model and for the window Claude Code assumes for a model ID it does not recognize. Read October 23, 2026.
  • Environment variables, for DISABLE_COMPACT and DISABLE_AUTO_COMPACT. Read October 23, 2026.
  • LM Studio bug tracker, issue 2482, for the no complete prefix line, which is reported against LM Studio and matches its app's wording. Read October 23, 2026.
  • Our own library pages, for the Context Details popover and for stall recovery: context details and context stall recovery. Read October 23, 2026.

Anthropic's error reference moves with nearly every Claude Code release, and it keeps notes such as "Before v2.1.269" and "Before v2.1.304". Read it again before you trust a copy of this page from a few months back.

Common questions

Why does Claude Code say the prompt is too long?

The conversation plus the files attached to it has grown past the model's context window, so the request no longer fits. Run /compact to summarize earlier turns and free space, or /clear to start fresh, and run /context to see what is using the window. An interactive session prints the same condition as the Context limit reached line.

Should I run /compact or /clear?

Both free the window and they differ in what comes back. /compact summarizes the conversation so far and keeps you in the same session, which is what you want when the work continues. /clear starts a new conversation with empty context, which fits a change of task. The manual /compact command keeps working even while auto-compact is off.

Why did automatic compaction fail?

The message names an underlying error, such as an unavailable model or an authentication failure, because automatic compaction ran on that turn and failed on it. Fix that error first, since /compact fails on the same error until you do. If the error came right after you stopped Claude while it was compacting, update to v2.1.304 or later, run /compact and send your message again.

Does Claude Code print a message about image limits and reserved summary space?

Anthropic's Claude Code documentation carries no such message. The wording matches LM Studio's, reported as issue 2482 in its bug tracker. A Claude Code session that stopped over size prints Prompt is too long or one of the request-size and image messages further up this page.