openai/openai-python · error · ValueError
Expected a non-empty value for `call_id` but received {call_
Error message
Expected a non-empty value for `call_id` but received {call_id!r} What it means
Raised by RealtimeCalls.sync accept() when the `call_id` argument is falsy (empty string or None). The SDK validates path parameters before making the HTTP request because an empty call_id would produce a malformed URL (/realtime/calls//accept). It is a client-side guard, not a server response.
Source
Thrown at src/openai/resources/realtime/calls.py:265
cache), since messages are dropped from the beginning of the context. However,
clients can also configure truncation to retain messages up to a fraction of the
maximum context size, which will reduce the need for future truncations and thus
improve the cache rate.
Truncation can be disabled entirely, which means the server will never truncate
but would instead return an error if the conversation exceeds the model's input
token limit.
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
extra_body: Add additional JSON properties to the request
timeout: Override the client-level default timeout for this request, in seconds
"""
if not call_id:
raise ValueError(f"Expected a non-empty value for `call_id` but received {call_id!r}")
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
return self._post(
path_template("/realtime/calls/{call_id}/accept", call_id=call_id),
body=maybe_transform(
{
"type": type,
"audio": audio,
"include": include,
"instructions": instructions,
"max_output_tokens": max_output_tokens,
"model": model,
"output_modalities": output_modalities,
"parallel_tool_calls": parallel_tool_calls,
"prompt": prompt,
"reasoning": reasoning,
"tool_choice": tool_choice,
"tools": tools,
"tracing": tracing,View on GitHub (pinned to 9917c6e28e)
Solutions
- Ensure call_id comes from a valid source, e.g. the `call` object's id from a realtime event or client.realtime.calls.create()
- Check for a non-empty value before calling accept(): if not call_id: raise/log
- If call_id is Optional in your flow, guard the whole call behind `if call_id is not None`
Example fix
// before
client.realtime.calls.accept(call_id=call_id or "")
# after
if not call_id:
raise ValueError("call_id missing; was the call created?")
client.realtime.calls.accept(call_id=call_id) Defensive patterns
Strategy: validation
Validate before calling
if not isinstance(call_id, str) or not call_id.strip():
raise ValueError(f"invalid call_id: {call_id!r}")
client.realtime.calls.accept(call_id=call_id) Type guard
def is_valid_call_id(v: object) -> bool:
return isinstance(v, str) and bool(v.strip()) Try / catch
try:
client.realtime.calls.accept(call_id=call_id)
except ValueError as e:
logger.error("bad call_id: %s", e) Prevention
- Always source call_id from the call resource or call events
- Never default call_id to an empty string
- Log ids when calls are created
When it happens
Trigger: Calling client.realtime.calls.accept(call_id="") or call_id=None (or a variable that was never populated, e.g. an empty field from a call.created event payload).
Common situations: Storing call_id from an event where the field was absent, typo'd variable, defaulting call_id to "" instead of omit, or passing a falsy sentinel before the call object was created.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- Expected a non-empty value for `response_id` but received {r
- Expected `bedrock_token_provider` argument to return a non-e
- Expected a non-empty value for `project_id` but received {pr
- Expected a non-empty value for `project_id` but received {pr
- Expected a non-empty value for `project_id` but received {pr
AI-assisted analysis of openai/openai-python@9917c6e28e (2026-08-28).
Data as JSON: /api/errors/bb1ac3d4d156e9a3.
Report an issue: GitHub.