Claude Code error
Claude Code: API Error: Claude's response exceeded the ... output token maximum
API Error: Claude's response exceeded the ... output token maximum. To configure this behavior, set the CLAUDE_CODE_MAX_OUTPUT_TOKENS environment variable.Status: WorkaroundLast verified 3 documented fixes2 sources
What it means
Claude's reply reached the largest number of output tokens the request allowed and was cut off. A variant, "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.", means a streaming request failed and was re-sent without streaming.
Causes
- A reply longer than the configured output token limit
- A streaming request falling back to non-streaming, which caps replies at 64,000 output tokens
How to fix it
- Fix 1.
If Claude wrote some text before being cut off, reply continue in an interactive session to ask for the rest.
Snippetcontinue - Fix 2.
If the message says to set CLAUDE_CODE_MAX_OUTPUT_TOKENS, set it per the env-vars docs (the value is capped).
- Fix 3.
Ask Claude for output in smaller pieces, such as one file or one section per reply.
More Claude Code errors
All 18 Claude Code errorsAPI Error: 500 Internal server error. This is a server-side issue, usually temporaryStatus: WorkaroundAPI Error: Repeated 529 Overloaded errors. The API is at capacityStatus: WorkaroundAPI Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.5: `tool_use` ids were found without `tool_result` blocks immediately after: toolu_01FRvEykWmCgrgJ22mvBbKhV. Each `tool_use` block must have a corresponding `tool_result` block in the next message."}}Status: OpenUnable to connect to API. Check your internet connectionStatus: WorkaroundUnable to connect to API: SSL certificate verification failed (UNABLE_TO_GET_ISSUER_CERT_LOCALLY).Status: WorkaroundPlease run /login · API Error: 401 OAuth token has expiredStatus: WorkaroundOAuth error: timeout of 15000ms exceededStatus: OpenPrompt is too longStatus: Workaround
Related reading
- Agent Harness Lessons From a 500B-Token Decompile: Give Agents a PASS/FAIL OracleAgent harness lessons from a 500B+ token decompile: a byte-matching PASS/FAIL oracle beat the reviewer agent. How agents cheated it and what to copy.
- Anthropic Now Watermarks All Claude Output: Text Watermarks and C2PA for FilesClaude text watermarking: Claude models released after August 2, 2026 embed a watermark in generated text and C2PA provenance in files. What is known so far.
- Claude Code Sends 33k Tokens Before Your Prompt - OpenCode Sends 7kClaude Code sends about 33k tokens before your prompt, OpenCode about 7k. The methodology, cache economics and the HN debate over whether the overhead pays off.
- Image Token Compression Is a Real Agent Cost LeverImage token compression cuts agent costs by rendering bulky context as images, but it is lossy. Where to use it, the byte-safety rule, and the evals it needs.
- Claude Code Token Burn Is an Observability ProblemClaude Code token burn is an observability problem. Why coding agents need cache-hit telemetry, spend ceilings and repro-grade usage logs, not a quota bar.
- Codeburn: The First TUI That Actually Shows Where Your Claude Max Subscription Is GoingCodeburn is a terminal dashboard for Claude Code and Cursor token spend. What it shows, where the data comes from, and how it ties into over-editing.
FAQ
What does "API Error: Claude's response exceeded the ... output token maximum" mean in Claude Code?
Claude's reply reached the largest number of output tokens the request allowed and was cut off. A variant, "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.", means a streaming request failed and was re-sent without streaming.
How do I fix "API Error: Claude's response exceeded the ... output token maximum"?
There are 3 documented fixes. Start with the first: If Claude wrote some text before being cut off, reply continue in an interactive session to ask for the rest.
Is this Claude Code error fixed?
Status: Workaround. No release removes the cause. The documented fixes work around it. Affected versions: All versions. Before v2.1.299, a reply cut off on a re-sent non-streaming request ended the turn silently.
Sources
Last verified against 2 sources: official docs, maintainer replies and release notes.
Newsletter
Fixes for the tools you use, weekly
One email per week. New coding agent releases, what broke, and how developers are working around it.