AI & Agent Dev Bug Sandbox logo
AI & Agent Dev Bug Sandbox
Back to Radar

ChatAnthropic Streaming Fails With No Generation Chunks When Using Bedrock Proxy SSE Without Event Field

langchain-anthropic 1.3.4 with anthropic 0.84.0 sends streaming request to a Bedrock proxy that returns SSE data lines without event: fields; the SDK ignores them, causing zero chunks and ValueError.

highConfidence 86%Langchain-AnthropicVector StoresChainsAffected Vanthropic==0.84.0Affected Vlangchain-Anthropic==1.3.4

Origin Analysis

The Anthropic SDK's SSE parser (v0.84.0) requires an 'event:' line to set the event type before each 'data:' line. The Bedrock proxy omits event lines, so all events are treated as unknown and skipped, yielding no chunks.
Use ChatAnthropic with base_url pointing to a Bedrock proxy that does not emit event: lines, set streaming=True, and call model.stream('...'). The stream iterator is empty and langchain raises ValueError: No generation chunks were returned.

Fixing Code Block

Edge Case Audit

This hotfix ignores all non-text events (message_start, message_delta, tool_use, errors). It is a workaround, not a production fix. For production, either configure the proxy to emit proper event: lines or use ChatBedrock from langchain-aws. If you must use this patch, pin anthropic and test thoroughly; rollback by removing the function and restoring original ChatAnthropic usage after proxy correction.

Ecosystem Topology

Agent Frameworks

LangChain, LlamaIndex, and Pydantic

  1. highProperty graph relation keys collide when entity IDs or labels contain underscores
  2. highCodeActAgent drops assistant tool-call metadata during handoff, leaving an orphan tool response
  3. high[Bug]: HierarchicalNodeParser async methods return the documents unsplit
  4. highLLM.predict_and_call fails with ValidationError for non-function-calling models when react_chat_formatter is omitted
  5. highAnthropic streaming server-tool input_json_delta overwrites completed client tool_use arguments due to stale cur_tool_call state