BerriAI/litellm · error · ValueError

Unsupported MIME type for embedding

Error message

Unsupported MIME type for embedding: {media_type}. Supported types: {', '.join(sorted(SUPPORTED_EMBEDDING_MIME_TYPES))}

What it means

Gemini data-URL parser guard: the declared media_type is not within SUPPORTED_EMBEDDING_MIME_TYPES, so the payload cannot be embedded by Gemini multimodal embedding and is rejected with the allowed list.

Solutions

  1. Use one of the supported MIME types listed in the error (e.g. image/png, image/jpeg) for the media you embed.
  2. Convert the file to a supported format before embedding, or correct the mime_type parameter passed for the media.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/llms/vertex_ai/gemini_embeddings/batch_embed_content_transformation.py:119 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at litellm/llms/vertex_ai/gemini_embeddings/batch_embed_content_transformation.py:119

        ValueError: If data URL format is invalid or MIME type is unsupported
    """
    if not data_url.startswith("data:"):
        raise ValueError(f"Invalid data URL format: {data_url[:50]}...")

    if "," not in data_url:
        raise ValueError(f"Invalid data URL format (missing comma): {data_url[:50]}...")

    metadata, base64_data = data_url.split(",", 1)

    metadata = metadata[5:]

    if ";" in metadata:
        media_type = metadata.split(";")[0]
    else:
        media_type = metadata

    if media_type not in SUPPORTED_EMBEDDING_MIME_TYPES:
        raise ValueError(
            f"Unsupported MIME type for embedding: {media_type}. "
            f"Supported types: {', '.join(sorted(SUPPORTED_EMBEDDING_MIME_TYPES))}"
        )

    return media_type, base64_data


def _is_multimodal_input(input: GeminiEmbeddingInput) -> bool:
    """
    Check if the input contains multimodal data (data URIs, file references,
    GCS URLs, or nested lists for combined embeddings).

    Args:
        input: GeminiEmbeddingInput — str, List[str], or List[List[str]] for combined embeddings

    Returns:
        bool: True if any element is multimodal or a nested list
    """

View on GitHub (pinned to 77b7c6c40c)