- Symptom
- Premature closeFails only on long generations
- Cause
- Old SDK versions such as 0.32 with a non-streaming create call buffer the whole response, and long responses can die mid-transfer.
- Fix
- Upgrade the SDK and use streaming for long outputs, with a retry wrapper.
- Apply
const msg = await client.messages.stream({ model, max_tokens, messages }).finalMessage();- Affected
- @anthropic-ai/sdk 0.32.1, fixed on 0.111, July 2026
Last verified 2026-07-13 · Confirmed by 0 builders