BerriAI/litellm · error · ValueError
Chat provider: Invalid function argument delta {parsed_chunk
Error message
Chat provider: Invalid function argument delta {parsed_chunk} What it means
For response.function_call_arguments.delta events the transformer requires a non-None 'delta' field carrying the argument fragment; if delta is missing or None it raises. The delta is the incremental tool-call argument string streamed by the provider.
Source
Thrown at litellm/completion_extras/litellm_responses_transformation/transformation.py:1315
choices=[
StreamingChoices(
index=0,
delta=Delta(
tool_calls=[
ChatCompletionToolCallChunk(
id=None,
index=tool_call_index,
type="function",
function=ChatCompletionToolCallFunctionChunk(name=None, arguments=content_part),
)
]
),
finish_reason=None,
)
]
)
else:
raise ValueError(f"Chat provider: Invalid function argument delta {parsed_chunk}")
elif event_type == ResponsesAPIStreamEvents.OUTPUT_ITEM_DONE:
# New output item added
output_item = parsed_chunk.get("item", {})
if output_item.get("type") in ("function_call", "custom_tool_call"):
if tool_call_index_map is None:
# Stateless callers (the responses guardrail handler extracting
# tool calls from a buffered output_item.done) get the complete
# tool call; per-stream callers already received it via
# output_item.added and the argument delta events
return ModelResponseStream(
choices=[ # mutable-ok: ModelResponseStream coerces only list choices
StreamingChoices(
index=0,
delta=Delta(
tool_calls=(
_tool_call_dict_from_output_item(
output_item, parsed_chunk.get("output_index", 0)
),View on GitHub (pinned to 6c2dcb801b)
Solutions
- Filter out delta events with no payload before transformation: skip if event.get('delta') is None
- If behind a gateway, update it or report the event shape divergence
- Upgrade litellm in case tolerances for empty deltas have been added
Example fix
# before
for ev in events:
chunks = transformer.chunk_parser(ev, ...)
# after — tolerate providers that emit delta events without a payload
for ev in events:
if ev.get("type") == "response.function_call_arguments.delta" and ev.get("delta") is None:
continue
chunks = transformer.chunk_parser(ev, ...) Defensive patterns
Strategy: validation
Validate before calling
def delta_event_valid(ev: dict) -> bool:
return ev.get("type") != "response.function_call_arguments.delta" or ev.get("delta") is not None Try / catch
try:
out = transformer.chunk_parser(ev, ...)
except ValueError as e:
if "Invalid function argument delta" in str(e):
out = None # tolerate provider emitting empty delta events
else:
raise Prevention
- Filter delta events lacking a payload before transformation
- Verify gateway/provider Responses API emulation against OpenAI's event schema
When it happens
Trigger: A provider or proxy emits response.function_call_arguments.delta events with the delta field omitted or null (e.g. an empty keep-alive delta or a non-conformant gateway rewriting events).
Common situations: Non-OpenAI providers whose Responses API emulation drops empty deltas instead of omitting the event; proxies that re-serialize events and lose null-adjacent fields; older fixtures recorded before the field was required.
Related errors
- Chat provider: Invalid text delta {parsed_chunk}
- Chat provider: Empty parsed_chunk
- Chat provider: Invalid chunk type {type(parsed_chunk)}
- Braintrust API error: {e.response.text}
- Failed to connect to Braintrust API: {str(e)}
AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15).
Data as JSON: /api/errors/454d8a5eeb9f9a5a.
Report an issue: GitHub.