BerriAI/litellm · error · Exception

Prop `{type}` is not supported

Error message

Prop `{type}` is not supported

What it means

Thrown by the Bytez adapter when a chat message content item has a `type` that has no Bytez mapping. The mapping (`open_ai_to_bytez_content_item_map`) only supports `text`, `image_url`, `input_audio`, and `video_url`; `document` and `file` are explicitly mapped to None, and any other type raises a KeyError before this check. This is a request-shape error: the OpenAI-style content you sent cannot be translated to Bytez's format.

Source

Thrown at litellm/llms/bytez/chat/transformation.py:398

    new_messages: Final = []

    for message in messages:
        role = message["role"]
        content: list = message["content"]

        new_content = []

        for content_item in content:
            type: str | None = content_item.get("type")

            if not type:
                raise Exception("Prop `type` is not a string")

            content_item_map = open_ai_to_bytez_content_item_map[type]

            if not content_item_map:
                raise Exception(f"Prop `{type}` is not supported")

            new_type = content_item_map["type"]

            value_name = content_item_map["value_name"]

            value: str | None = content_item.get(value_name)

            if not value:
                raise Exception(f"Prop `{value_name}` is not a string")

            new_content.append({"type": new_type, value_name: value})

        new_messages.append({"role": role, "content": new_content})

    return new_messages


# "content": "The cat ran so fast"

View on GitHub (pinned to 6c2dcb801b)

Solutions

  1. Remove or replace unsupported content items: only `text`, `image_url`, `input_audio`, and `video_url` types are accepted by Bytez.
  2. If you sent a `document`/`file` part, extract the text yourself and send it as a `{"type": "text", "text": ...}` item.
  3. Filter messages with a pre-flight check (see validation) before calling litellm so unsupported types are dropped or converted client-side.
  4. If you need file/document chat, switch to a provider that supports those content types (e.g. OpenAI, Anthropic, Gemini) instead of Bytez.

Example fix

// before
messages = [{"role": "user", "content": [
    {"type": "text", "text": "summarize"},
    {"type": "document", "document": {"file_id": "doc_123"}}
]}]
litellm.completion(model="bytez/openai/gpt-4o", messages=messages)

// after
messages = [{"role": "user", "content": [
    {"type": "text", "text": "summarize this: <extracted document text>"}
]}]
litellm.completion(model="bytez/openai/gpt-4o", messages=messages)
Defensive patterns

Strategy: validation

Validate before calling

SUPPORTED = {"text", "image_url", "input_audio", "video_url"}

def validate_bytez_messages(messages):
    for i, m in enumerate(messages):
        content = m.get("content")
        if not isinstance(content, list):
            continue
        for j, part in enumerate(content):
            if isinstance(part, dict) and part.get("type") not in SUPPORTED:
                raise ValueError(f"messages[{i}].content[{j}] type {part.get('type')!r} unsupported by bytez")

Type guard

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

Prevention

When it happens

Trigger: Calling `litellm.completion(..., model="bytez/...", messages=[{"role": "user", "content": [{"type": "document", ...}]}])` or sending a content item with type `file`, `input_video`, `audio`, or any non-mapped type. Also a plain `KeyError` if the type string is entirely unknown to the map dict.

Common situations: Porting a multimodal OpenAI app (PDF/file uploads, newer content types like `file` or `input_video`) to Bytez; using a prompt built for another provider that supports document parts; copying example payloads from OpenAI docs that Bytez has not implemented.

Related errors


AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15). Data as JSON: /api/errors/089f48d39a585632. Report an issue: GitHub.