{"record":{"id":"51293e27ce29a246","repo":"BerriAI/litellm","slug":"oci-response-contained-no-choices","errorCode":null,"errorMessage":"OCI response contained no choices","messagePattern":"OCI response contained no choices","errorType":"exception","errorClass":"OCIError","httpStatus":null,"severity":"error","filePath":"litellm/llms/oci/chat/generic.py","lineNumber":322,"sourceCode":"    model_response: ModelResponse,\n    raw_response: httpx.Response,\n) -> ModelResponse:\n    \"\"\"Parse a non-streaming GENERIC OCI response into a LiteLLM ModelResponse.\"\"\"\n    try:\n        completion_response: Final = OCICompletionResponse(**json_data)\n    except (TypeError, ValidationError) as e:\n        raise OCIError(\n            message=f\"Response cannot be casted to OCICompletionResponse: {e}\",\n            status_code=raw_response.status_code,\n        )\n\n    iso_str: Final = completion_response.chatResponse.timeCreated\n    dt: Final = datetime.datetime.fromisoformat(iso_str.replace(\"Z\", \"+00:00\"))\n    model_response.created = int(dt.timestamp())\n    model_response.model = completion_response.modelId\n\n    if not completion_response.chatResponse.choices:\n        raise OCIError(\n            message=\"OCI response contained no choices\",\n            status_code=raw_response.status_code,\n        )\n\n    response_choice: Final = completion_response.chatResponse.choices[0]\n    message: Final = model_response.choices[0].message\n    response_message: Final = response_choice.message\n    if response_message is not None:\n        if response_message.content:\n            # Concatenate all text parts — matches the streaming handler, which\n            # iterates the full content array. Skips non-text parts (e.g. image\n            # parts) so a leading non-text part doesn't suppress trailing text.\n            text: str | None = None\n            for item in response_message.content:\n                if isinstance(item, OCITextContentPart):\n                    text = (text or \"\") + item.text\n            if text is not None:\n                message.content = text","sourceCodeStart":304,"sourceCodeEnd":340,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/oci/chat/generic.py#L304-L340","documentation":"Error \"OCI response contained no choices\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/llms/oci/chat/generic.py:322 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the OCI request (compartment, model, serving mode); an empty choices list usually means the model returned nothing—retry or adjust the prompt/max_tokens."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}