[BUG] API Error: Claude's response exceeded the 32000 output token maximum.

2 min read Original article ↗

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

Hi,

I just asked Claude Code to implement something relatively hard. After 8 minutes of thinking, there is this error in the Claude Code terminal window:

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

However it still seems to be thinking (14 minutes now), so it's probably still going. It hasn't given me any feedback of what it's doing or thinking.

✽ Shenaniganing… (11m 35s · ↓ 35.0k tokens · thinking)

Claude Code on PowerShell on Windows Terminal, Windows 11, latest version (updated today). Using Opus 4.6. On the Pro plan currently.

I found a few related issues (other users encountering this issue) but they are all closed or in a different context.

What Should Happen?

No error, or a better explanation.

Error Messages/Logs

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

Steps to Reproduce

I can share my prompt privately if you want to contact me. But I suspect this is reproducible with any prompt that requires long thinking (very complex task).

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

2.1.37 (Claude Code)

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

Windows Terminal

Additional Information

No response