Skip to content

[Sparkth] Handle transient httpx.RemoteProtocolError in Anthropic streaming #189

@hamza-56

Description

@hamza-56

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.

  1. No retry logicChatAnthropic in app/core_plugins/chat/providers.py is instantiated without max_retries, so the SDK does not retry on transient failures.
  2. 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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions