BerriAI/litellm · error · Exception
An unknown error occurred with the stream
Error message
An unknown error occurred with the stream
What it means
Streaming chunk-parser fallback: when chunk parsing for a provider (e.g. nlp_cloud) fails with an exception not matching known cases, a generic 'unknown stream error' is raised — the chunk was not convertible into a completion object and no more specific diagnosis exists.
Solutions
- Retry the streaming request and enable verbose logging to capture the underlying error.
- Check provider status and network stability.
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at litellm/litellm_core_utils/streaming_handler.py:1288 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/e5ab0c4a398e0ace.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/litellm_core_utils/streaming_handler.py:1288
elif (
self.custom_llm_provider and self.custom_llm_provider == "aleph_alpha"
): # aleph alpha doesn't provide streaming
response_obj = self.handle_aleph_alpha_chunk(chunk)
completion_obj["content"] = response_obj["text"]
if response_obj["is_finished"]:
self.received_finish_reason = response_obj["finish_reason"]
elif self.custom_llm_provider == "nlp_cloud":
try:
response_obj = self.handle_nlp_cloud_chunk(chunk)
completion_obj["content"] = response_obj["text"]
if response_obj["is_finished"]:
self.received_finish_reason = response_obj["finish_reason"]
except Exception as e:
if self.received_finish_reason:
raise e
else:
if self.sent_first_chunk is False:
raise Exception("An unknown error occurred with the stream")
self.received_finish_reason = "stop"
elif self.custom_llm_provider == "vertex_ai" and not isinstance(chunk, ModelResponseStream):
vertex_chunk: Final = cast(_VertexChunkLike, chunk)
import proto
if hasattr(vertex_chunk, "candidates") is True:
try:
try:
completion_obj["content"] = vertex_chunk.text
except Exception as e:
original_exception: Final = e
if "Part has no text." in str(e):
## check for function calling
function_call: Final = vertex_chunk.candidates[0].content.parts[0].function_call
args_dict: Final = {}
# Check if it's a RepeatedComposite instanceView on GitHub (pinned to 77b7c6c40c)