- Symptom
- stop_reason: max_tokens with zero text blocksA report or document arrives blank
- Cause
- max_tokens covers thinking as well as the visible answer. On a busy prompt the model can spend the whole budget thinking and return no text.
- Fix
- Raise max_tokens well above the expected answer length, log stop_reason, and treat empty text or stop_reason max_tokens as a failed attempt that retries with a larger budget.
- Apply
if (res.stop_reason === 'max_tokens' || !text) { retry with max_tokens * 2 }- Affected
- Claude models with thinking, August 2026
Last verified 2026-08-02 · Confirmed by 0 builders