BerriAI/litellm · error · Exception

Received streaming error

Error message

Received streaming error - {e}

What it means

Stream error surfaced while parsing Bedrock streaming chunks in the model response iterator: the provider emitted an error event/exception mid-stream, and the chunk parser wraps it so the partially assembled stream terminates with the provider's error detail.

Solutions

  1. Inspect the streamed error event for the underlying Bedrock error and fix its cause.
  2. Retry the request; transient stream errors often succeed on retry.
  3. Reduce request size or check model access if the error persists.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at litellm/llms/bedrock/chat/invoke_handler.py:591 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/1762fc9daec9bdf5. Report an issue: GitHub.

Appendix: source

Thrown at litellm/llms/bedrock/chat/invoke_handler.py:591

                        delta=Delta(
                            content=text,
                            role="assistant",
                            tool_calls=[tool_use] if tool_use else None,
                            provider_specific_fields=(provider_specific_fields if provider_specific_fields else None),
                            thinking_blocks=thinking_blocks,
                            reasoning_content=reasoning_content,
                        ),
                    )
                ],
                id=self.response_id,
                model=self.model,
                usage=usage,
                provider_specific_fields=model_response_provider_specific_fields,
            )

            return response
        except Exception as e:
            raise Exception(f"Received streaming error - {e}")

    def _chunk_parser(self, chunk_data: dict) -> GChunk | ModelResponseStream | dict:
        text = ""
        is_finished = False
        finish_reason = ""
        if "outputText" in chunk_data:
            text = chunk_data["outputText"]
        # ai21 mapping
        elif "ai21" in self.model:  # fake ai21 streaming
            text = chunk_data["completions"][0]["data"]["text"]
            is_finished = True
            finish_reason = "stop"
        ######## /bedrock/converse mappings ###############
        elif (
            "contentBlockIndex" in chunk_data
            or "stopReason" in chunk_data
            or "metrics" in chunk_data
            or "trace" in chunk_data

View on GitHub (pinned to 77b7c6c40c)