BerriAI/litellm · error · OCIError

OCI response contained no choices

Error message

OCI response contained no choices

What it means

Error "OCI response contained no choices" thrown in BerriAI/litellm.

Source

Thrown at litellm/llms/oci/chat/generic.py:322

    model_response: ModelResponse,
    raw_response: httpx.Response,
) -> ModelResponse:
    """Parse a non-streaming GENERIC OCI response into a LiteLLM ModelResponse."""
    try:
        completion_response: Final = OCICompletionResponse(**json_data)
    except (TypeError, ValidationError) as e:
        raise OCIError(
            message=f"Response cannot be casted to OCICompletionResponse: {e}",
            status_code=raw_response.status_code,
        )

    iso_str: Final = completion_response.chatResponse.timeCreated
    dt: Final = datetime.datetime.fromisoformat(iso_str.replace("Z", "+00:00"))
    model_response.created = int(dt.timestamp())
    model_response.model = completion_response.modelId

    if not completion_response.chatResponse.choices:
        raise OCIError(
            message="OCI response contained no choices",
            status_code=raw_response.status_code,
        )

    response_choice: Final = completion_response.chatResponse.choices[0]
    message: Final = model_response.choices[0].message
    response_message: Final = response_choice.message
    if response_message is not None:
        if response_message.content:
            # Concatenate all text parts — matches the streaming handler, which
            # iterates the full content array. Skips non-text parts (e.g. image
            # parts) so a leading non-text part doesn't suppress trailing text.
            text: str | None = None
            for item in response_message.content:
                if isinstance(item, OCITextContentPart):
                    text = (text or "") + item.text
            if text is not None:
                message.content = text

View on GitHub (pinned to 6c2dcb801b)

Solutions

  1. The OCI response contained no choices; check the model and request.

When it happens

Trigger: Thrown at litellm/llms/oci/chat/generic.py:322 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/51293e27ce29a246. Report an issue: GitHub.