- Symptom
- Cannot read properties of undefinedDiagnosis or summary field silently falls back to a placeholderWorks on small prompts, fails on real ones
- Cause
- Models with adaptive thinking can put a thinking block before the text block. Whether they do depends on the prompt, so short tests return text first and look fine.
- Fix
- Collect every block whose type is text and join them; fail loudly when there is none. Test with the real payload, not a toy prompt.
- Apply
const text = res.content.filter(b => b.type === 'text').map(b => b.text).join(''); if (!text) throw new Error('no text block, stop_reason=' + res.stop_reason);- Affected
- Claude models with adaptive thinking, July 2026
Last verified 2026-07-18 · Confirmed by 0 builders