BerriAI/litellm · error · OCIError

Content type ` ` is not supported by OCI

Error message

Content type `{item_type}` is not supported by OCI

What it means

OCI GENERIC models only accept content parts of type "text" and "image_url"; the translator explicitly whitelists these two. Any other discriminator value (e.g. "audio", "input_audio", "video", "file") raises OCIError 400. The error embeds the offending type so you can see exactly which part was rejected.

Solutions

  1. Remove or convert unsupported parts: keep only text and image_url parts for OCI GENERIC models
  2. Transcribe audio out-of-band (e.g. with an STT model) and pass the transcript as a text part
  3. Route requests containing other modalities to a provider/model that supports them, based on the parts present
  4. Filter content parts per target model in a pre-send normalization step

Example fix

# before
content = [
  {"type": "text", "text": "describe"},
  {"type": "input_audio", "input_audio": {"data": b64, "format": "wav"}},
]
litellm.completion(model="oci/generic.m", messages=[{"role":"user","content":content}])

# after: transcribe first, send text
content = [
  {"type": "text", "text": "describe"},
  {"type": "text", "text": transcript},
]
Defensive patterns

Strategy: validation

Validate before calling

SUPPORTED = {"text", "image_url"}

def filter_supported_parts(content: list) -> list:
    return [p for p in content if p.get("type") in SUPPORTED]

Type guard

def part_supported_by_oci(part) -> bool:
    return isinstance(part, dict) and part.get("type") in {"text", "image_url"}

Prevention

When it happens

Trigger: Sending multimodal content that includes a non-supported part to an oci/generic.* model: [{"type":"input_audio","input_audio":{...}}] or {"type":"file","file":{...}}. Raised client-side during message adaptation, before the OCI request.

Common situations: Reusing an OpenAI multimodal prompt (with audio/file parts) against OCI; provider-agnostic code that forwards every part type; OCI GENERIC genuinely lacking the modality — the request must be restructured before it can succeed.

Related errors


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/669d5065808be937. Report an issue: GitHub.

Appendix: source

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

        return OCIMessage(
            role=open_ai_to_generic_oci_role_map[role],
            content=[OCITextContentPart(text=content)],
            toolCalls=None,
            toolCallId=None,
        )

    for content_item in content:
        if not isinstance(content_item, dict):
            raise OCIError(status_code=400, message="Each content item must be a dictionary")

        item_type = content_item.get("type")
        if not isinstance(item_type, str):
            raise OCIError(
                status_code=400,
                message="Each content item must have a string `type` field",
            )
        if item_type not in ["text", "image_url"]:
            raise OCIError(
                status_code=400,
                message=f"Content type `{item_type}` is not supported by OCI",
            )

        if item_type == "text":
            text = content_item.get("text")
            if not isinstance(text, str):
                raise OCIError(
                    status_code=400,
                    message="Content item of type `text` must have a string `text` field",
                )
            new_content.append(OCITextContentPart(text=text))

        elif item_type == "image_url":
            image_url = content_item.get("image_url")
            if isinstance(image_url, dict):
                image_url = image_url.get("url")
            if not isinstance(image_url, str):

View on GitHub (pinned to 77b7c6c40c)