BerriAI/litellm · error · OCIError
Invalid tool_choice for OCI: unsupported type {raw_type!r};
Error message
Invalid tool_choice for OCI: unsupported type {raw_type!r}; expected one of 'FUNCTION', 'AUTO', 'NONE', 'REQUIRED' What it means
Error "Invalid tool_choice for OCI: unsupported type {raw_type!r}; expected one of 'FUNCTION', 'AUTO', 'NONE', 'REQUIRED'" thrown in BerriAI/litellm.
Source
Thrown at litellm/llms/oci/chat/transformation.py:170
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__}"),
)
def _normalize_response_format(selected_params: dict, vendor: OCIVendors) -> None:
rf: Final = selected_params.get("responseFormat")
if not isinstance(rf, dict) or "type" not in rf:
return
View on GitHub (pinned to 6c2dcb801b)
Solutions
- Use tool_choice type 'FUNCTION', 'AUTO', 'NONE', or 'REQUIRED'.
When it happens
Trigger: Thrown at litellm/llms/oci/chat/transformation.py:170 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/669d0033365b9bc9.
Report an issue: GitHub.