[BUG] Claude Desktop: no way to set CLAUDE_CODE_MAX_OUTPUT_TOKENS, session tokens consumed on failed response

Resolved 💬 6 comments Opened Mar 25, 2026 by boardtc Closed Jun 20, 2026

Preflight Checklist

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

What's Wrong?

What happened
Ran a task to read 3 scanned PDF diaries and write a markdown
table of trips to trips.md. Claude read the PDFs successfully
then hit this error when attempting to write output:

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

Problem
Claude Desktop provides no mechanism to set
CLAUDE_CODE_MAX_OUTPUT_TOKENS. The environment variable fix
documented in the error message is only available via CLI.
There is no UI option, no settings field, and no way to pass
env vars to a Desktop session.

Impact

  • ~50% of session tokens consumed with no usable output
  • No refund or recovery mechanism
  • Only workaround is to restart session and hope chunked

prompting keeps responses under the limit

What Should Happen?

Expected behaviour
Either:

  1. Desktop UI should expose CLAUDE_CODE_MAX_OUTPUT_TOKENS as

a configurable setting, or

  1. Claude should automatically chunk large outputs rather than

failing with a hard error

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

Steps to reproduce

  1. Open Claude Desktop session with a directory containing

large PDFs

  1. Ask Claude to read PDFs and write a large markdown table
  2. Observe error when output exceeds 32k tokens
  3. Observe no way to increase limit within Desktop

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.83 (Claude Code)

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

Other

Additional Information

_No response_

View original on GitHub ↗

This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗