BerriAI/litellm · error · ValueError

Nested (combined) embeddings are not supported on the embedC

Error message

Nested (combined) embeddings are not supported on the embedContent path. Use the batchEmbedContents path or pass a flat list instead.

What it means

Gemini embedContent path guard: the input contains a nested list (combined multimodal embedding), which only the batchEmbedContents endpoint supports; the single-request embedContent path rejects it and points to the batch API.

Source

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

    Args:
        input: GeminiEmbeddingInput with text, data URIs, or file references
        model: Model name
        optional_params: Additional parameters (taskType, outputDimensionality, etc.)
        resolved_files: Dict mapping file names (files/abc) to {mime_type, uri}

    Returns:
        dict: Gemini embedContent request body with content.parts
    """
    resolved_files = resolved_files or {}

    gemini_params: Final = _filter_embed_params(optional_params)

    input_list: Final = [input] if isinstance(input, str) else input
    parts: Final[list[PartType]] = []

    for element in input_list:
        if isinstance(element, list):
            raise ValueError(
                "Nested (combined) embeddings are not supported on the embedContent path. "
                "Use the batchEmbedContents path or pass a flat list instead."
            )
        if not isinstance(element, str):
            raise ValueError(f"Unsupported input type: {type(element)}")
        parts.append(_build_part_for_input(element, resolved_files=resolved_files))

    request_body: Final[dict] = {
        "content": ContentType(parts=parts),
        **gemini_params,
    }

    return request_body


_IMAGE_MIME_TYPES: Final = frozenset({"image/png", "image/jpeg"})
_VIDEO_TOKENS_PER_SECOND: Final = 258.0
_AUDIO_TOKENS_PER_SECOND: Final = 32.0

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Flatten the nested input into a single flat list of strings/images before calling embedContent.
  2. Alternatively use the batchEmbedContents path (async batch embedding) which supports combined/nested inputs.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/llms/vertex_ai/gemini_embeddings/batch_embed_content_transformation.py:284 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/1da4ed900aebba40. Report an issue: GitHub.