BerriAI/litellm · error · OCIError
Chunk cannot be parsed as OCIStreamChunk: {e}
Error message
Chunk cannot be parsed as OCIStreamChunk: {e} What it means
Error "Chunk cannot be parsed as OCIStreamChunk: {e}" thrown in BerriAI/litellm.
Source
Thrown at litellm/llms/oci/chat/generic.py:372
reasoning_tokens=reasoning_tokens,
)
return model_response
def handle_generic_stream_chunk(dict_chunk: dict) -> ModelResponseStream:
"""Parse a single GENERIC SSE chunk into a LiteLLM ModelResponseStream."""
# OCI streams tool calls progressively — early chunks may omit required fields.
if dict_chunk.get("message") and dict_chunk["message"].get("toolCalls"):
for tool_call in dict_chunk["message"]["toolCalls"]:
tool_call.setdefault("arguments", "")
tool_call.setdefault("id", "")
tool_call.setdefault("name", "")
try:
typed_chunk: Final = OCIStreamChunk(**dict_chunk)
except (TypeError, ValidationError) as e:
raise OCIError(
status_code=500,
message=f"Chunk cannot be parsed as OCIStreamChunk: {e}",
)
if typed_chunk.index is None:
typed_chunk.index = 0
# Emit ``content=None`` rather than ``content=""`` on chunks with no text
# parts (e.g. tool-call-only or keep-alive chunks) so downstream
# stream-mergers that distinguish "no text in this delta" from "an
# explicitly empty text delta" behave correctly.
text: str | None = None
if typed_chunk.message and typed_chunk.message.content:
for item in typed_chunk.message.content:
if isinstance(item, OCITextContentPart):
text = (text or "") + item.text
elif isinstance(item, OCIImageContentPart):
raise OCIError(View on GitHub (pinned to 6c2dcb801b)
Solutions
- The OCI stream chunk did not match the expected schema; see the wrapped exception.
When it happens
Trigger: Thrown at litellm/llms/oci/chat/generic.py:372 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15).
Data as JSON: /api/errors/a4744b40cf9711a0.
Report an issue: GitHub.