Claude Streaming Connection Dropped Mid-Response
Your SSE stream terminated before Claude finished responding. Common causes: network timeout, proxy limits, load balancer idle timeout, or client disconnect. Fix with proper stream event handling and reconnection logic.
Watch for the message_stop event to know the stream completed cleanly. If the stream ends without it, treat as incomplete and retry. Also check for error events mid-stream — these indicate mid-response failures.
The Error Message You're Seeing
event: error
data: {"type":"error","error":{"type":"overloaded_error","message":"Overloaded"}}
# OR — connection just closes silently without message_stop event
# OR — Python/JS throws:
anthropic.APIConnectionError: Connection error.
caused by: aiohttp.ClientPayloadError: Response payload is not completed
What Actually Causes This Error
Fixes That Work (Tested Nov 2026)
1Handle All Stream Events Properly
2Increase Client and Proxy Timeouts
Proxy/load balancer configuration:
- NGINX: Set
proxy_read_timeout 600s;for the Anthropic upstream - AWS ALB: Increase idle timeout to 600s (max 4000s)
- Cloudflare: Consumers of your API need to know 100s edge timeout applies — use WebSockets for very long streams
- Vercel/Netlify: Serverless functions have hard limits; use edge functions or streaming responses to their limits
3Retry With Non-Streaming Fallback
Preventing This Error Going Forward
- Always watch for message_stop. Never assume a stream is complete without it.
- Configure timeouts up the stack. Client, proxy, load balancer, and framework must all allow long streams.
- Implement graceful degradation. If streams fail, fall back to non-streaming.
- Monitor stream completion rates. Track message_stop events per stream start — should be near 100%.
- Log accumulated content on disconnect. Partial responses are debuggable; silent drops are not.
Researcher · AI Error Hub
Frequently Asked Questions
Yes. Output tokens generated before the disconnect are billed. This is why proper stream handling matters — you're paying for tokens even if your client didn't receive them cleanly.
No. Claude doesn't support resumable streams. If a stream drops, you must restart from scratch (or make a new non-streaming call). Design your UI to handle occasional restarts gracefully.
Same total generation time, but streaming shows tokens as they're generated — better perceived latency. First-token-latency (TTFT) is typically 100-500ms. For UX, streaming feels ~5x faster to users even though it's the same wall clock.
Yes, but understand the sequence. Tool use blocks stream just like text — you get partial JSON as it generates. Wait for the complete tool_use block before calling the tool. Don't act on partial JSON.
It does, but Workers have a 100s CPU limit and specific streaming APIs (ReadableStream). Use TransformStream to properly pipe SSE from Anthropic to your client. Naive fetch+read patterns often break.
Related Errors
Streaming AI Best Practices Weekly
SSE handling, WebSocket alternatives, and streaming architecture patterns. 12,000+ developers subscribe.
Subscribe Free →