BerriAI/litellm · error · ValueError
Error updating current item chunks: {e}, got transformed_mes
Error message
Error updating current item chunks: {e}, got transformed_message: {transformed_message} What it means
Raised in update_current_item_chunks, the item-level counterpart of the delta-chunk accumulator. It reads transformed_message['type'] looking for 'response.output_item.done'; any exception (non-dict input, missing 'type') is caught and re-raised as ValueError embedding the transformed_message. Guards internal state consistency while assembling completed output items.
Source
Thrown at litellm/llms/gemini/realtime/transformation.py:964
if isinstance(transformed_message, list):
current_item_chunks = []
any_item_chunk = False
for event in transformed_message:
if event["type"] == "response.output_item.done":
current_item_chunks.append(cast(OpenAIRealtimeOutputItemDone, event))
any_item_chunk = True
if not any_item_chunk:
current_item_chunks = None
else:
if transformed_message["type"] == "response.output_item.done":
if current_item_chunks is None:
current_item_chunks = []
current_item_chunks.append(cast(OpenAIRealtimeOutputItemDone, transformed_message))
else:
current_item_chunks = None
return current_item_chunks
except Exception as e:
raise ValueError(f"Error updating current item chunks: {e}, got transformed_message: {transformed_message}")
def transform_response_done_event(
self,
message: BidiGenerateContentServerMessage,
current_response_id: str | None,
current_conversation_id: str | None,
output_items: list[OpenAIRealtimeOutputItemDone] | None,
session_configuration_request: str | None = None,
) -> OpenAIRealtimeDoneEvent:
if current_conversation_id is None:
current_conversation_id = f"conv_{uuid.uuid4()}"
if current_response_id is None:
current_response_id = f"resp_{uuid.uuid4()}"
if session_configuration_request:
session_configuration_request_dict: BidiGenerateContentSetup = json.loads(
session_configuration_request
).get("setup", {})View on GitHub (pinned to 6c2dcb801b)
Solutions
- Feed only transformer-output events (OpenAIRealtimeEvents) into this helper.
- Add a shape check (dict with 'type') before calling.
- Upgrade litellm when the error originates inside the library loop.
Example fix
# before
items = config.update_current_item_chunks(transformed_message=frame, current_item_chunks=items)
# after
if not (isinstance(frame, dict) and 'type' in frame):
raise TypeError('expected transformed OpenAI realtime event dict')
items = config.update_current_item_chunks(transformed_message=frame, current_item_chunks=items)
Defensive patterns
Strategy: type-guard
Validate before calling
def is_transformed_event(msg) -> bool:
return isinstance(msg, dict) and "type" in msg Type guard
def is_transformed_event(msg: object) -> bool:
return isinstance(msg, dict) and isinstance(msg.get("type"), str) Try / catch
try:
items = config.update_current_item_chunks(transformed_message=msg, current_item_chunks=items)
except ValueError as e:
if "Error updating current item chunks" in str(e):
logger.error("Item state update failed on: %r", msg)
items = None
else:
raise Prevention
- Feed only OpenAI-shaped transformed events into item-chunk accumulation.
- Keep transformer and state-helper versions in lockstep (same litellm release).
- Log the failing payload to spot producer/consumer shape mismatches early.
When it happens
Trigger: Passing a transformed_message that is not a dict with a 'type' key (raw string, Gemini-native frame, None) into update_current_item_chunks; list inputs whose elements are malformed.
Common situations: Direct use of the realtime transformer's state helpers in custom bridges; version mismatches between the transformer and hand-rolled event producers; test fixtures with simplified event dicts.
Related errors
- Error updating current delta chunks: {e}, got transformed_me
- Unexpected delta type: {delta_type}
- Unknown openai event: {openai_event}
- Unexpected responses stream payload
- api_key is required for Gemini API calls
AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15).
Data as JSON: /api/errors/f05e4cf287afdf72.
Report an issue: GitHub.