{"record":{"id":"37151c263a09ac3c","repo":"BerriAI/litellm","slug":"invalid-tool-choice-for-oci-expected-str-or-dict","errorCode":null,"errorMessage":"Invalid tool_choice for OCI: expected str or dict, got {type(tc).__name__}","messagePattern":"Invalid tool_choice for OCI: expected str or dict, got (.+?)","errorType":"exception","errorClass":"OCIError","httpStatus":400,"severity":"error","filePath":"litellm/llms/oci/chat/transformation.py","lineNumber":178,"sourceCode":"            name: Final = fn.get(\"name\") if isinstance(fn, dict) else tc.get(\"name\")\n            if not (isinstance(name, str) and name):\n                raise OCIError(\n                    status_code=400,\n                    message=\"Invalid tool_choice for OCI: 'FUNCTION' type requires a non-empty function name\",\n                )\n            selected_params[\"toolChoice\"] = {\"type\": \"FUNCTION\", \"name\": name}\n        elif upper in {\"AUTO\", \"NONE\", \"REQUIRED\"}:\n            selected_params[\"toolChoice\"] = {\"type\": upper}\n        else:\n            raise OCIError(\n                status_code=400,\n                message=(\n                    f\"Invalid tool_choice for OCI: unsupported type {raw_type!r}; \"\n                    \"expected one of 'FUNCTION', 'AUTO', 'NONE', 'REQUIRED'\"\n                ),\n            )\n        return\n    raise OCIError(\n        status_code=400,\n        message=(f\"Invalid tool_choice for OCI: expected str or dict, got {type(tc).__name__}\"),\n    )\n\n\ndef _normalize_response_format(selected_params: dict, vendor: OCIVendors) -> None:\n    rf: Final = selected_params.get(\"responseFormat\")\n    if not isinstance(rf, dict) or \"type\" not in rf:\n        return\n\n    rf_type: Final = str(rf[\"type\"]).lower()\n    raw_schema: Final = rf.get(\"json_schema\")\n    json_schema: Final = raw_schema if isinstance(raw_schema, dict) else None\n\n    if rf_type == \"text\":\n        selected_params[\"responseFormat\"] = {\"type\": \"TEXT\"}\n        return\n","sourceCodeStart":160,"sourceCodeEnd":196,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/oci/chat/transformation.py#L160-L196","documentation":"Error \"Invalid tool_choice for OCI: expected str or dict, got {type(tc).__name__}\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/llms/oci/chat/transformation.py:178 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass tool_choice as a string or dict."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}