When streaming responses from the Anthropic API, the connection is occasionally dropped mid-response, causing an unhandled httpx.RemoteProtocolError:
httpx.RemoteProtocolError: peer closed connection without sending complete message body (incomplete chunked read)
This is a transient network/API error that is not currently caught or retried.
- No retry logic —
ChatAnthropic in app/core_plugins/chat/providers.py is instantiated without max_retries, so the SDK does not retry on transient failures.
- Missing exception handling — The streaming methods (
_stream_message_simple, _stream_message_with_tools) and send_message do not catch httpx.RemoteProtocolError, so the error propagates unhandled.
When streaming responses from the Anthropic API, the connection is occasionally dropped mid-response, causing an unhandled
httpx.RemoteProtocolError:This is a transient network/API error that is not currently caught or retried.
ChatAnthropicinapp/core_plugins/chat/providers.pyis instantiated withoutmax_retries, so the SDK does not retry on transient failures._stream_message_simple,_stream_message_with_tools) andsend_messagedo not catchhttpx.RemoteProtocolError, so the error propagates unhandled.