Omniscio

OmniscioGuidesClaude Code compaction errors

Claude Code compaction errors explained

The messages Claude Code prints when it cannot make room in its own context window, word for word, with what each one means and the steps that clear it. Compaction is the pass that summarizes older turns so the session can keep going; when it fails, the session is usually stuck between a conversation too long to send and a conversation too long to summarize. Every message here comes from Anthropic's own documentation or from a GitHub issue where a user pasted it, and each section names its source.

Sources last checked on October 27, 2026. By the Omniscio team. Updated .

How these were sourced

For the Claude Code errors this page does not cover, the wider catalogue is on the Claude Code error messages guide.

Every message on this page was read on October 23, 2026, either from Anthropic's own pages or from the GitHub issue where a user reported it, and each section names which of the two it is. The four sections changed on October 27, 2026 carry that date in their own note. Nothing here was raised on a test machine, so no section shows a terminal capture it does not have.

Anthropic's error reference changes with nearly every Claude Code release and keeps notes such as "Before v2.1.269", so a version boundary can be the whole answer to a message that used to appear and no longer does. Where a version matters it is named in the fix steps.

Prompt is too long · automatic compaction failed

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

What it means. Claude Code tried to summarize the conversation to make room and the summary request failed. The text after the colon is the real error, and it is the thing to fix: an unavailable model, an authentication failure, a gateway that rejects the request, or anything else that would have failed on its own.

What causes it

  • A second failure underneath: a bad credential, a model the account cannot reach, or a network problem.
  • A custom ANTHROPIC_BASE_URL serving a model ID Claude Code does not recognise, so it assumes a 200K window.
  • A version before 2.1.299 on a custom base URL, where the turn ended with this message near an assumed 200K window instead of sending the request.

How to fix it

  1. Fix the named error first. /compact fails on the same error until you do.
  2. On a custom ANTHROPIC_BASE_URL, give Claude Code the model's real context window, or run claude update to 2.1.299 or later.
  3. If it started right after you stopped Claude while it was compacting, run /compact and send your message again, then update to 2.1.304 or later so stopping at that moment cannot end the turn.
  4. Anthropic notes that on 2.1.305, with many MCP tools and a direct connection to its API, this message can hide an unrelated 400 or 422; update to 2.1.306 or later to see the original error.

What not to do

Do not run /compact over and over. It sends the same request to the same broken thing and fails the same way each time. Read the words after the colon before you touch anything else.

Source: Anthropic's error reference, read October 27, 2026.

Error during compaction: Conversation too long

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

What it means. The summary request was itself too large for the model to accept. The conversation is too long to send and too long to summarize, which is the deadlock this whole page is about. One user reported this wording, and Anthropic's error reference does not list it.

What causes it

  • A conversation that grew past the model's window before any compaction pass ran.
  • Auto-compact switched off in /config or with DISABLE_AUTO_COMPACT, so nothing made room on the way up.
  • A version before 2.1.269, where compaction failed whenever it could not summarize a whole exchange.

How to fix it

  1. Do what the message says: press Esc twice to step back a few messages, then try /compact again.
  2. If stepping back does not reduce it enough, run /clear and carry on in a fresh conversation.
  3. Run /context to see which row is taking the space. Messages is one row; the system prompt, tools and memory files are the others.
  4. Turn auto-compact back on in /config, or unset DISABLE_AUTO_COMPACT, so the next session compacts before it reaches this.
  5. Run claude update. From v2.1.269, Claude Code keeps your newest prompt word for word and summarizes everything before it when no whole exchange can be summarized.

What not to do

Do not keep sending new messages to try to push past it. Every message you add makes the request larger, and each one fails on the same wall. Do not delete the transcript file to "reset" the session either, because /clear is the documented way to start fresh.

The wording is quoted from GitHub issue #26518, where one user hit it at 4% remaining until auto-compact with about 15 subagents finished. Anthropic's docs do not list this wording; the recovery rules for a window that has filled are in Anthropic's error reference. Both read October 27, 2026.

A single-exchange conversation cannot be compacted

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.

What it means. There is only one exchange in the conversation, so there is nothing earlier to summarize. Compaction has no work to do, and Claude Code says so instead of trying. The message lists what is actually filling the request, which is where the fix is.

What causes it

  • One very large paste, or one message carrying large attachments, on the first turn of a session.
  • An unusually large set of tool definitions from MCP servers you are not using.
  • Large memory files loaded at startup.

How to fix it

  1. Run /clear and send the content again in smaller pieces, or reference the file by path so Claude reads it in chunks.
  2. Run /context to see whether the space is the system prompt, the tools, the memory files or the message itself.
  3. Turn off MCP servers you are not using with /mcp disable <name>. Their tool definitions are sent with every request.
  4. Trim a large CLAUDE.md, or move instructions into path-scoped rules, which load when Claude reads, writes or edits the matching file.
  5. If you need the bigger window rather than a smaller request, select a 1M-context model variant, where the same rule applies at the larger limit.

What not to do

Do not run /compact expecting it to work once you have the message. There is no earlier turn for it to summarize, and you will get the same answer.

Source: Anthropic's error reference, read October 23, 2026. Anthropic notes that before v2.1.162 Claude Code attempted the compaction anyway and surfaced a bare Prompt is too long when it failed.

The request is mostly this conversation's own content

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).

What it means. This is the measured form of the message above. The API reported its own token counts, and Claude Code compared them with its estimate of the conversation to work out which part is the bulk. Here, the conversation itself is the bulk, so smaller files and less pasted text are the answer.

What causes it

  • A single prompt carrying a large file or a long paste.
  • A first turn that attached more than the model's window can hold alongside the conversation.

How to fix it

  1. Start again with /clear and give the file as a path instead of pasting its contents.
  2. Split the task so each turn reads what it needs rather than everything up front.
  3. Ask Claude to read a specific function or line range rather than the whole file.

What not to do

Do not paste the same content again in a second message to "make it clearer" in the hope that the added text fixes the size. It can only make the request bigger.

Source: Anthropic's error reference, read October 23, 2026.

Most of the request is outside the conversation

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. The same measured message, pointing the other way: the conversation is small and the overhead Claude Code sends with every request is the bulk. Compaction is the wrong lever, because there is almost nothing in the conversation to summarize. The fix is to make what loads around it smaller.

What causes it

  • Many MCP servers, whose tool definitions are sent on every request whether you use them or not.
  • Large memory files loaded at session start.
  • Attached files that travel with each request.
  • A model ID Claude Code does not recognize, so it assumes a window smaller than the model's real one.

How to fix it

  1. Run /context and read which row is largest. This message is telling you it is not the Messages row.
  2. Disable the MCP servers you are not using with /mcp disable <name>.
  3. Trim large CLAUDE.md memory files, and move detail into path-scoped rules.
  4. Drop attachments that the next turn does not need.
  5. If the model is a gateway alias Claude Code does not recognize, give it the model's real context window, or run claude update so a version that recognizes the ID can do it.

What not to do

Do not treat this as a conversation-length problem. Clearing the conversation frees almost nothing when the bulk is the system prompt, the tools and the attachments, and you lose the work you had.

Source: Anthropic's error reference, read October 23, 2026.

Not enough messages to compact

Not enough messages to compact.

What it means. You asked for a summary and there is nothing to summarize: the conversation has too few turns. Anthropic's troubleshooting page names the case that surprises people, where a single large paste filled the window on its own.

What causes it

  • A single large paste that filled the context on its own.
  • What Claude Code sends with every request, the system prompt, tool definitions and attachments, taking most of the window.

How to fix it

  1. Run /clear and send the content again with less pasted text or smaller attachments.
  2. Reduce what loads at startup, following the steps under the request being mostly overhead.
  3. If you have a long conversation that should compact and still gets this, run /context and check the Messages row against the rows above it.

What not to do

Do not read this as the conversation being too short to worry about. It can appear even with a full context, and then the full part is either one oversized message or what Claude Code sends with every request.

Source: Anthropic's troubleshooting page and its error reference, both read October 23, 2026.

Autocompact is thrashing

Autocompact is thrashing: the context refilled to the limit...

What it means. Compaction worked, and then a file or a tool output immediately refilled the window. That happened several times in a row, so Claude Code stopped retrying rather than spend API calls on a loop that is not making progress. Anthropic writes the message with the ellipsis shown here, so the exact tail varies.

What causes it

  • A file or a tool output that refilled the context window immediately after the summary, several times in a row.

How to fix it

  1. Ask Claude to read the oversized file in smaller chunks, such as a line range or a single function, rather than the whole file.
  2. Run /compact with a focus that drops the large output, for example /compact keep only the plan and the diff.
  3. Move the large-file work to a subagent, so it runs in its own context window and only the summary comes back.
  4. Run /clear if the earlier conversation is no longer needed.
  5. If it comes back after a /clear, run /context. If Messages is the largest row, keep at the first three steps; if the other rows together are larger, reduce what loads at startup.

What not to do

Do not reach for a smaller auto-compact window. Anthropic's windows start at 100,000 tokens, and what refilled this window is a file or a tool output, so work through the /context check above instead.

Source: Anthropic's troubleshooting page, read October 23, 2026.

Context limit reached · /compact or /clear to continue

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

What it means. This is the interactive form of Prompt is too long: the conversation no longer fits the model's window. The second line adds the reason and shows only when a /config change would fix it. The third shows when DISABLE_COMPACT is set, because then manual compaction is off too and only /clear is left.

What causes it

  • A conversation that reached the window before a compaction pass ran.
  • Auto-compact turned off with the Auto-compact toggle in /config or with DISABLE_AUTO_COMPACT, or every kind of compaction turned off with DISABLE_COMPACT.

How to fix it

  1. Run /compact to summarize earlier turns and keep going, or /clear to start fresh. If the line names /clear alone, DISABLE_COMPACT is set; unset it to get /compact back.
  2. For the rest of the options on a full window, including what to trim and what to switch off, see the Claude Code error messages guide.

What not to do

Do not expect the auto-compact hint every time. Anthropic says it appears only when a /config change would take effect.

Source: Anthropic's error reference, read October 23, 2026. The hint arrived in v2.1.235.

Context exceeds the 200k-token limit

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

What it means. Not an error, but the warning /context prints at the top of its output once the conversation has grown past the model's window. The figure is how far over you are, and requests fail with Prompt is too long until you free the space.

What causes it

  • A conversation that grew past the window with compaction switched off.

How to fix it

  1. Run /compact to summarize earlier turns and free the space, or /clear to start fresh.
  2. For every way to reduce usage, see the Claude Code error messages guide.

What not to do

Do not read the warning as the cause of the failure. It is /context reporting that the conversation is already past the window.

Source: Anthropic's error reference, read October 23, 2026. Before v2.1.216, /context showed usage above 100% with no warning line.

Context is past the 200k-token compaction window

Context is 94k tokens past the 200k-token compaction window — run /compact to reduce usage.

What it means. A compaction window can sit below the model's context window: on a 1M-context model held to a 200K boundary, the automatic pass runs at 200K even though the model accepts more. Requests past that boundary can still succeed. This form names /clear instead of /compact when DISABLE_COMPACT is set.

What causes it

  • A compaction window set below the model's own context window: a value chosen with CLAUDE_CODE_AUTO_COMPACT_WINDOW, or a session running a 200K window because CLAUDE_CODE_DISABLE_1M_CONTEXT=1 is set or the model reaches 1M only through its [1m] variant.
  • Configuration that stopped the 200K hold from being enforced, so the session grew past it with no threshold to trip.

How to fix it

  1. Run /compact to bring the conversation back under the window.
  2. For how to set the window, and what happens to a value on either side of the accepted range, see the auto-compact window warnings. The rest of the context-window fixes are on the Claude Code error messages guide.

What not to do

Do not set the window above the model's context window expecting more room. Anthropic's docs say Claude Code caps it at the model's window, so the extra has no effect.

Sources: Anthropic's error reference and its model configuration page, for the window, the 100K-to-1M range, the cap at the model's own window, CLAUDE_CODE_DISABLE_1M_CONTEXT and the [1m] variant. Both read October 27, 2026.

Auto mode classifier transcript exceeded context window

Auto mode classifier transcript exceeded context window — falling back to manual approval (try /compact to reduce conversation size)

What it means. In auto mode a separate classifier model reviews each action before it runs, and that review is its own request. When the conversation is too long for the classifier to read, auto mode cannot decide, and Claude Code falls back to asking you instead of acting. Compaction is what brings the classifier back within range.

What causes it

  • A conversation that grew past the window the classifier request can carry.
  • Auto-compact off, whether in /config or with DISABLE_AUTO_COMPACT. Anthropic’s reference addresses that case directly: turn it back on so Claude Code compacts on its own next time.
  • A background subagent in a non-interactive run, where the action gets no manual prompt: it returns an error reading Agent aborted: auto mode classifier transcript exceeded context window in headless mode and the run continues.

How to fix it

  1. In an interactive session, approve or deny the action in the prompt that appears.
  2. Run /compact so later actions fit within the classifier's window again.
  3. Turn auto-compact back on in /config, or unset DISABLE_AUTO_COMPACT, if you had switched it off.
  4. In a -p run without --permission-prompt-tool there is nothing to fall back to, so the action does not run and the run continues. Shorten the conversation before the next one.

What not to do

Do not read this as the action being refused on its merits. The classifier never reached a verdict, and nothing about the command was judged unsafe.

Sources: Anthropic's error reference for this message and its turn-it-back-on advice, and the same reference's prompt-too-long section for the /config toggle and DISABLE_AUTO_COMPACT. Both read October 27, 2026.

Input is too long for requested model, or capability_rejected

Input is too long for requested model.
capability_rejected: prompt_too_long

What it means. The same over-window condition as Prompt is too long, reported in a provider's own words. Amazon Bedrock reports it as the first line; a Claude apps gateway reports it as the second when a cloud upstream rejects the request. Claude Code treats both the same way.

What causes it

  • A conversation larger than the window the provider serves, behind Bedrock, a gateway or a proxy.
  • A Claude Code version that does not recognize the provider's wording. Before v2.1.217 auto-compact never triggered on the Bedrock wording, and before v2.1.228 it never triggered on the gateway token.

How to fix it

  1. Run claude update, so the wording is recognized and auto-compact triggers on it.
  2. Run /compact, or /clear to start fresh. For the rest of the options, see the Claude Code error messages guide.

What not to do

Do not go looking for these two on the Anthropic API error pages. They are a provider's wording, so those pages do not list them; the Claude Code error reference is where they are documented.

Source: Anthropic's error reference, read October 23, 2026.

Auto-compact window warnings and the unenforced 200K limit

CLAUDE_CODE_AUTO_COMPACT_WINDOW="<value>" reads as <N> tokens, so Claude Code treats it as the 100k minimum
CLAUDE_CODE_AUTO_COMPACT_WINDOW="<value>" is too large, so Claude Code treats it as the 1M maximum
CLAUDE_CODE_AUTO_COMPACT_WINDOW="<value>" isn't a usable size, so Claude Code ignores it
CLAUDE_CODE_DISABLE_1M_CONTEXT is set, but the 200K limit isn't enforced for <model>, so this session can grow past it. To enforce it, set CLAUDE_CODE_AUTO_COMPACT_WINDOW=200000 (or the autoCompactWindow setting).

What it means. These are the warnings that explain why compaction ran somewhere other than where you expected. The first three say the value you gave CLAUDE_CODE_AUTO_COMPACT_WINDOW is outside the accepted 100,000 to 1,000,000 range or is not a token count, and name the window the session uses instead. The fourth says nothing is holding a 1M-context session to the 200K boundary, so it can keep growing.

What causes it

  • A bare number read as tokens: CLAUDE_CODE_AUTO_COMPACT_WINDOW=200 means 200 tokens, where /autocompact 200 means 200,000.
  • A value outside 100,000 to 1,000,000. Before v2.1.304 the variable did not accept a k or M suffix.
  • A context-1m beta requested through ANTHROPIC_BETAS or the --betas flag, which still asks the API for the 1M window on a model that accepts that beta while nothing compacts the session at 200K.
  • A model ID Claude Code does not recognize, with CLAUDE_CODE_DISABLE_UNKNOWN_MODEL_WINDOW_ENFORCEMENT=1 set or its assumed window raised past 200K with CLAUDE_CODE_MAX_CONTEXT_TOKENS.

How to fix it

  1. Set the variable to a number inside the accepted range, such as CLAUDE_CODE_AUTO_COMPACT_WINDOW=200000, or use 200k on 2.1.304 or later.
  2. To get the 200K hold back on a 1M-context session, set CLAUDE_CODE_AUTO_COMPACT_WINDOW=200000 or the autoCompactWindow setting to 200000.
  3. If the warning names a model ID this version does not recognize, run claude update.
  4. If you meant the session to use the model's full window, unset CLAUDE_CODE_DISABLE_1M_CONTEXT.

What not to do

Do not assume an unset variable means the default window. The setting, the launch flag and the command can each set it, and the variable takes precedence over all three when it is set and usable.

Source: Anthropic's error reference and the values and warnings table on its model configuration page, both read October 23, 2026.

Keeping several sessions inside their windows

Every error on this page starts the same way: a session fills its window, and the fix arrives after the fact. Omniscio, the desktop app we make for running many Claude Code sessions at once, shows how full each session's context is and can warn you at 75% and 90% so you can compact on your terms. Both warnings ship switched off, and you turn them on in Settings, in the Sessions section, where they read "Warn at 75% context full" and "Warn at 90% context full"; once one is showing, the options button on that line in the chat switches them too. While a session is parked waiting on background work the warning stays quiet, and each one fires at most once until a real compaction frees space. The context usage warnings page covers that. After a compaction, the session feed shows a "Conversation compacted" divider whose Show summary link expands the summary Claude wrote, so you can read what survived. The features page lists the rest of it, and the download page has the installers.

Sources

Every message and every fix on this page rests on one of these. The date beside each one is the day it was read.

  • Claude Code error reference, for the context, compaction, single-exchange and auto mode messages and the steps under each. Read October 27, 2026.
  • Claude Code troubleshooting, for the auto-compaction thrashing case and the not-enough-messages note. Read October 23, 2026.
  • Model configuration, for the auto-compact window, the accepted values and the default thresholds per model. Read October 27, 2026.
  • Explore the context window, for the model variants that reach a million tokens and the note that compaction behaves the same at that limit. Read October 23, 2026.
  • Commands, for /compact, /autocompact and /clear. Read October 23, 2026.
  • Environment variables, for DISABLE_AUTO_COMPACT, DISABLE_COMPACT and CLAUDE_CODE_AUTO_COMPACT_WINDOW. Read October 23, 2026.
  • Costs, for the compaction instructions you can put in CLAUDE.md and the note that compacting a large context is itself a large request. Read October 23, 2026.
  • Wording Anthropic's documentation does not carry, quoted from the issue where a user reported it: #26518 for the older compaction wording and what state produced it. Read October 23, 2026.

Anthropic's error reference moves with nearly every Claude Code release. Read it again before you trust a copy of this page from a few months back, and check the version notes behind each fix.

Common questions

Why does /compact fail when the context is nearly full?

Compacting is itself a request: Claude Code sends the conversation it is summarizing to the model. When the conversation is already larger than the model accepts, that request fails too, which is why the fix is usually to press Esc twice and go back a few messages, or to run /clear, rather than to run /compact again.

What does Not enough messages to compact mean?

The conversation has too few turns to summarize. Anthropic's troubleshooting page gives the common cause: a single large paste filled the context, so there is nothing earlier to summarize. Run /clear and send the content again in smaller pieces.

What is auto-compact, and is it on by default?

Auto-compact is the automatic pass that summarizes older history as the window fills. Anthropic's docs say it is on by default and normally prevents the Prompt is too long error. You can turn it off in /config with the Auto-compact toggle, or with the DISABLE_AUTO_COMPACT environment variable wherever it is set.

What does Autocompact is thrashing mean?

Automatic compaction succeeded, but a file or a tool output immediately refilled the context window several times in a row. Claude Code stops retrying to avoid spending API calls on a loop that is not making progress. Read the oversized output in smaller chunks, or move that work to a subagent.

Can I make Claude Code compact earlier, before it gets this far?

Yes. Run /autocompact with a token count such as /autocompact 500k, set the autoCompactWindow setting, pass --autocompact at launch, or set CLAUDE_CODE_AUTO_COMPACT_WINDOW for scripts and cloud environments. Anthropic's docs say the accepted range is 100,000 to 1,000,000 tokens.

Where is Anthropic's own list of these errors?

Anthropic keeps an error reference at code.claude.com/docs/en/errors, with the auto-compaction thrashing case on the troubleshooting page beside it. This page covers thirteen compaction errors and links each one to the page it came from.