BerriAI/litellm · error · OCIError
Invalid tool_choice for OCI: 'FUNCTION' type requires a non-
Error message
Invalid tool_choice for OCI: 'FUNCTION' type requires a non-empty function name
What it means
Error "Invalid tool_choice for OCI: 'FUNCTION' type requires a non-empty function name" thrown in BerriAI/litellm.
Source
Thrown at litellm/llms/oci/chat/transformation.py:162
"none": {"type": "NONE"},
"required": {"type": "REQUIRED"},
"any": {"type": "REQUIRED"},
}
selected_params["toolChoice"] = tc_map.get(tc.lower(), {"type": "FUNCTION", "name": tc})
return
if isinstance(tc, dict):
raw_type: Final = tc.get("type")
if not isinstance(raw_type, str):
raise OCIError(
status_code=400,
message=f"Invalid tool_choice for OCI: missing or non-string 'type' in {tc!r}",
)
upper: Final = raw_type.upper()
if upper == "FUNCTION":
fn: Final = tc.get("function")
name: Final = fn.get("name") if isinstance(fn, dict) else tc.get("name")
if not (isinstance(name, str) and name):
raise OCIError(
status_code=400,
message="Invalid tool_choice for OCI: 'FUNCTION' type requires a non-empty function name",
)
selected_params["toolChoice"] = {"type": "FUNCTION", "name": name}
elif upper in {"AUTO", "NONE", "REQUIRED"}:
selected_params["toolChoice"] = {"type": upper}
else:
raise OCIError(
status_code=400,
message=(
f"Invalid tool_choice for OCI: unsupported type {raw_type!r}; "
"expected one of 'FUNCTION', 'AUTO', 'NONE', 'REQUIRED'"
),
)
return
raise OCIError(
status_code=400,
message=(f"Invalid tool_choice for OCI: expected str or dict, got {type(tc).__name__}"),View on GitHub (pinned to 6c2dcb801b)
Solutions
- Provide a non-empty function name for tool_choice type 'FUNCTION'.
When it happens
Trigger: Thrown at litellm/llms/oci/chat/transformation.py:162 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/ad969e85fbbd8b5b.
Report an issue: GitHub.