'ThinkingBlock' object has no attribute 'text': Why a Newer Claude Model No Longer Starts Its Response with Text, and How to Fix It
You switched your Claude API calls to a newer model, and now you get AttributeError: 'ThinkingBlock' object has no attribute 'text', or the response text comes back empty. The cause is that Claude 5 and later models think when needed even if you don't set thinking, so the first block of the response becomes a thinking block. Claude 4 models didn't think unless you set it, so changing only the model name changes the shape of the response. With simple inputs the first block is still text, so tests that use light inputs pass. Based on Anthropic's documentation and my own tests of four models (November 1, 2026), this article covers the cause, how to fix it by finding text blocks by type (Python and TypeScript), what to do when max_tokens leaves you with no text, which models can and can't turn thinking off, and how not to miss it in testing.