Omniscio

OmniscioGuidesClaude Code output limit

Claude Code exceeded the 32000 output token maximum: what the message means

Claude Code stops a reply when it reaches the largest number of output tokens the request allowed, and the line it prints names the ceiling it hit. The number in that line is a per-request limit set by Claude Code and capped by the model, not the model's published maximum, which is how a session on a model with a 128K output limit can still print 32000. This page quotes the message, shows where the number comes from, gives the variable that raises it and where to set it, explains how a long thinking budget can spend the ceiling before any answer is written, and says what to do when the ceiling cannot move.

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

Which message did you see?

Pick the line closest to the one on your screen. The wording moves between releases, so the same condition can print differently on two versions, and the error reference notes some changes by version. If your line is not here, the Claude Code error messages guide covers the wider family.

Claude's response exceeded the 32000 output token maximum

API Error: Claude's response exceeded the 32000 output token maximum. To configure this behavior, set the CLAUDE_CODE_MAX_OUTPUT_TOKENS environment variable.

What it means. Claude's reply reached the largest number of output tokens the request allowed and was cut off there. The limit belongs to that request rather than to the session, so a later turn carries its own ceiling, and the text already written stays in the conversation.

The figure carries the ceiling that request went out with. It is not a fixed number across models or releases: Anthropic documents 32000 as the default for a model ID Claude Code cannot resolve to a model it knows, and users on named models have reported the same number in earlier releases, which is the source of the confusion around this error. Issue 24055 is the open one, filed in February 2026 on Opus 4.6 with Claude Code 2.1.37, where it has 86 reactions and 139 comments. Issue 24159 reported that setting the variable to 64000 left the output at 32000 on Opus 4.6, and it was closed in April 2026; issue 9365 reported 64000 being lowered to 32000 on v2.0.14 and closed in January 2026.

Two reports in those threads are worth knowing before you decide something is broken. The reporter on 24055 saw the line after about eight minutes of thinking, and the session kept thinking afterwards, which reads on screen as an error that did not stop the work. Issue 23553 reported the same thing and asked for a message that does not claim to block a run it did not block. Neither report is Anthropic's account of what happens, and neither changes what the line means: one reply stopped at a ceiling.

Where the number comes from

The variable the message names sets the maximum number of output tokens for most requests. Its defaults and caps vary by model, Claude Code lowers a value above a model's cap to the cap, and for a model ID it cannot resolve the default is 32000 and the cap is 128000. That case produces this exact line on a model whose own ceiling is far above 32000: a custom deployment name, a gateway, or a third-party model Claude Code does not recognize gets the unresolved default rather than the model's real ceiling.

ModelMax output
Claude Fable 5.1128K tokens
Claude Opus 5.5128K tokens
Claude Sonnet 5.5128K tokens
Claude Haiku 5.5128K tokens

Those are the synchronous Messages API figures from Anthropic's models page. On the Message Batches API, Anthropic lists Opus 5.5, Sonnet 5.5 and Haiku 5.5 among the models that support up to 300k output tokens with the output-300k-2026-03-24 beta header, which is a ceiling for batch work rather than something an interactive session can ask for.

A gap between the model's 128K and the figure in the message is the point of this page, and the next two sections close it: one shows how to raise the ceiling, and one shows the setting that can spend it before your answer is written.

Raising the ceiling with CLAUDE_CODE_MAX_OUTPUT_TOKENS

CLAUDE_CODE_MAX_OUTPUT_TOKENS is the documented answer, and the message tells you so. Set it to the ceiling you want, up to the model's cap: Claude Code lowers anything above the cap rather than failing, so an oversized value is harmless but also does nothing extra.

Where to set it

A variable in your shell lasts for that terminal session, and a variable in a settings file applies every time claude runs. For one session, set it before launching:

export CLAUDE_CODE_MAX_OUTPUT_TOKENS=64000
claude

On Windows PowerShell the same two lines read $env:CLAUDE_CODE_MAX_OUTPUT_TOKENS = "64000" and then claude, and to keep it across terminals you run [Environment]::SetEnvironmentVariable("CLAUDE_CODE_MAX_OUTPUT_TOKENS", "64000", "User") and open a new one. In Windows CMD the value for that terminal is set CLAUDE_CODE_MAX_OUTPUT_TOKENS=64000, and the permanent one is setx CLAUDE_CODE_MAX_OUTPUT_TOKENS 64000, which takes effect in a new terminal.

For every session, put it under the env key of a settings file instead. Claude Code reads those values straight from the file, so they take effect no matter how claude was launched:

{
  "env": {
    "CLAUDE_CODE_MAX_OUTPUT_TOKENS": "64000"
  }
}

Which file you use decides who gets the value: ~/.claude/settings.json for you in every project, the project's .claude/settings.json for everyone working in that repository, .claude/settings.local.json for you in that project only, and managed settings for an organization. When the same variable is set in both your shell and a settings file, the settings file value applies in most sessions, and between files the higher-precedence scope wins.

Values in a settings file are applied to a running session when you save the file, while a value exported in a shell is read at startup, so a shell change takes effect the next time you launch claude.

What raising it costs

Anthropic states one trade directly in the variable's own entry: increasing the value reduces the effective context window available before auto-compaction triggers. The ceiling is part of the room a session has to work in, so a large output limit buys long replies with context space. The context window guide covers what the window does and how compaction behaves at the boundary.

When thinking spends the ceiling first

Thinking tokens are billed as output tokens and they count toward the same limit as the text: the tokens Claude spends reasoning count toward max_tokens alongside the response, even when the thinking is not shown. Anthropic says the default thinking budget can be tens of thousands of tokens per request depending on the model, so a long reasoning pass can reach 32000 before a line of answer exists. That is likely the mechanism behind the reports of this error arriving on a hard task, and it is why the work can look like it failed at 32000 tokens while the transcript shows almost no text.

Effort is the control on the models in the table

Every model in the table above uses adaptive reasoning: the model decides whether and how much to think on each step, and the effort level steers that. /effort takes a level from low to xhigh, plus max, and /model adjusts the same level on the models that support it. Lowering effort leaves more of the ceiling for the answer, and it does not change the ceiling itself.

The fixed budget is a different mechanism, and Anthropic's documentation is explicit that it does not apply to these models: the Fable models, Sonnet 5 and later, Haiku 5.5, and Opus 4.7 and later always use adaptive reasoning, and the fixed thinking budget mode does not apply to them. Claude Code ignores the number in MAX_THINKING_TOKENS on an adaptive-reasoning model.

Where the fixed budget still applies

On a model that still takes a fixed thinking budget, MAX_THINKING_TOKENS sets it, and Claude Code caps that budget at one token below the request's max output tokens, never below 1,024. The API holds the same relationship from its side: budget_tokens must be less than max_tokens, because thinking counts toward that limit and the budget has to leave room for the answer. A request that carries a budget at or above its output ceiling is refused:

API Error: 400 ... max_tokens must be greater than thinking.budget_tokens

That error is the API's own constraint rather than Claude Code's cap, which is why the two can look like they disagree. Anthropic's documented recovery is to raise CLAUDE_CODE_MAX_OUTPUT_TOKENS above the thinking budget. The one case Anthropic names where a budget may exceed max_tokens is interleaved thinking in manual mode, where the budget spans every thinking block in a single turn.

You cannot turn thinking off on Opus 5.5, Sonnet 5.5, Haiku 5.5 or the Fable models. On those, the session toggle and the /config row show that thinking cannot be turned off, and a saved alwaysThinkingEnabled: false or MAX_THINKING_TOKENS=0 has no effect. Effort is the control that remains.

For a request sent without streaming

API Error: Claude's response exceeded the 64000 output token maximum for a request sent without streaming. The CLAUDE_CODE_MAX_OUTPUT_TOKENS environment variable cannot raise this limit.

This form is a different case, and the line says so. A streaming request failed and Claude Code re-sent it without streaming, which limits the reply to 64,000 output tokens, and the variable cannot raise that ceiling. Before v2.1.299 a reply cut off on such a request ended the turn with no message at all, as though the answer were complete, so a short odd ending with no error is worth a second look on an older version.

The recovery is the same as for the other form: the text is in the conversation, so reply continue in an interactive session, and update Claude Code so the next cutoff at least reports itself.

When the ceiling cannot be raised

On a request with a fixed 64,000 ceiling, or a deployment where you cannot set the variable, Anthropic documents two moves and both work on the same idea: keep the reply under the ceiling.

  1. Reply continue in an interactive session when Claude had started writing. The text stays in the conversation and the answer resumes from it.
  2. Ask for the output in smaller pieces, such as one file or one section per reply, so no single reply has to hold the whole result.

A continuation does not raise the ceiling, and it is worth saying plainly because it surprises people: the next reply carries the same limit, so a 40,000-token file still needs splitting. What the continuation buys is the work already done.

What does not help

  • /compact and /clear free the input side. They make the conversation smaller, and they leave the reply ceiling where it was, so neither will let one reply run longer. The token usage guide covers where to read what a session has spent.
  • A larger context window does not move the output ceiling. The window limits what goes into a request and the ceiling limits what comes back, and a session on a model with a million-token window still carries that model's output limit, which is 128K on the current models.
  • Sending the same prompt again works through the same reasoning and can stop at the same ceiling. The first attempt already did that work, so a continuation is cheaper than a retry.
  • Setting CLAUDE_CODE_MAX_OUTPUT_TOKENS to the largest number you can type does not help either. Claude Code lowers it to the model's cap, and the reduced context room is real at any value above what you need.

Omniscio and this limit

Omniscio is the desktop app we make for running many Claude Code sessions at once. It does not raise this ceiling for a Claude Code session: at spawn, the app takes any inherited CLAUDE_CODE_MAX_OUTPUT_TOKENS back out of the environment it hands the claude binary, so the reply limit stays whatever Claude Code and the model set. The exception is a proxy lane whose vendor declares a completion ceiling below the binary's own request, where the app sets the variable to that vendor's number, because the vendor refuses every turn without it.

Those sessions run the same claude binary, so the settings route above reaches them: a value under env in your own ~/.claude/settings.json applies every time claude runs. The exception is the app's own tool-locked launches, such as its review runs and its locked email sessions, which start the binary with the user settings layer switched off. The features page lists what the app does do, and the download page has the installers.

Sources

Every line of the error, every setting and every limit on this page rests on one of these. The date beside each one is the day we read it.

  • Claude Code error reference, for both forms of the message, what each one means, the non-streaming re-send and its version note, the continue and smaller-pieces advice, and max_tokens must be greater than thinking.budget_tokens. Read October 26, 2026.
  • Environment variables, for CLAUDE_CODE_MAX_OUTPUT_TOKENS, its unresolved-model default of 32000 and cap of 128000, the context cost of raising it, MAX_THINKING_TOKENS, and where and how to set a variable. Read October 26, 2026.
  • Model configuration, for extended thinking, the effort level and the models whose thinking cannot be turned off. Read October 26, 2026.
  • Commands reference, for /effort and /model. Read October 26, 2026.
  • Costs, for thinking tokens counting as output tokens and the size of the default thinking budget. Read October 26, 2026.
  • Thinking, for thinking tokens counting toward max_tokens alongside the response text. Read October 26, 2026.
  • Extended thinking, for the rule that budget_tokens must be less than max_tokens and for the interleaved-thinking exception. Read October 26, 2026.
  • Models overview, for the 128K max output on the current models and the 300k batch limit. Read October 26, 2026.
  • GitHub issue 24055, open, for the error text as a user pasted it and for the report of a session that kept thinking after the line appeared. Read October 26, 2026.
  • GitHub issues 24159, 9365 and 23553, all closed, for the reports of the figure appearing on named models and of the session carrying on after it. Read October 26, 2026.

Anthropic's error reference and environment variable list move with nearly every Claude Code release, and the error reference carries notes such as "Before v2.1.299" where a behaviour changed. Read them again before you trust a copy of this page from a few months back.

Common questions

Why does the message say 32000 when my model supports 128K?

The figure is the ceiling that request carried, not your model's published maximum. Anthropic documents 32000 as the default ceiling for a model ID Claude Code cannot resolve to a model it knows, such as a custom deployment name or a third-party model, and 128000 as the cap there. For a model it does know, the docs say the defaults and caps vary by model, so the ceiling is that model's own default.

Does CLAUDE_CODE_MAX_OUTPUT_TOKENS always raise the limit?

It raises the ceiling the request carries, up to the model's documented cap, and Claude Code lowers any larger value to that cap. The exception is a request Claude Code re-sent without streaming after a streaming failure: that form names 64000 and says the variable cannot raise it.

Does a bigger context window fix the output limit?

No. The context window limits what goes into a request and the output ceiling limits the reply that comes back, and they are separate numbers. A larger window does not move the output ceiling, and raising the output ceiling leaves less room in the window before auto-compaction triggers.

Is the text Claude wrote before the error lost?

No. The text the reply had produced stays in the conversation, so reply continue in an interactive session and Claude picks the answer up from there. The next reply carries the same ceiling, so a very long answer still needs to arrive in pieces.