BerriAI/litellm · error · ValueError

`input` on /v1/embeddings batch requests must not be empty

Error message

`input` on /v1/embeddings batch requests must not be empty

What it means

Validation while transforming an /v1/embeddings batch entry: 'input' is present but empty (empty string or empty list), so the batch row would embed nothing and is rejected before upload to GCS.

Source

Thrown at litellm/llms/vertex_ai/files/transformation.py:486

    is an array fans out into one row per element and is reassembled on the way back.
    The docs put the per-row config in an `embed_content_config` sibling of `request`,
    but the API rejects that key outright and fails the whole batch job, so the config
    fields go inside the `EmbedContentRequest` itself.

    API Ref: https://cloud.google.com/vertex-ai/generative-ai/docs/embeddings/batch-prediction-genai-embeddings
    """
    openai_request_body = openai_entry.get("body")
    if not isinstance(openai_request_body, dict):
        raise TypeError(
            "`body` on /v1/embeddings batch requests must be a JSON object, but was missing or not an object"
        )
    embedding_input = openai_request_body.get("input")
    if embedding_input is None:
        raise ValueError("`input` is required on /v1/embeddings batch requests, but was not provided")

    elements = _openai_embedding_input_elements(embedding_input)
    if not elements:
        raise ValueError("`input` on /v1/embeddings batch requests must not be empty")

    embed_content_requests = tuple(
        transform_openai_input_gemini_embed_content(
            input=element,
            model=openai_request_body.get("model", ""),
            optional_params=openai_request_body,
        )
        for element in elements
    )
    custom_id = openai_entry.get("custom_id")
    return tuple(
        _vertex_embeddings_row(
            key=None
            if custom_id is None
            else _vertex_batch_embeddings_key(
                custom_id=str(custom_id),
                index=index,
                total=len(embed_content_requests),

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Provide a non-empty 'input' in the batch request body.

Example fix

# ensure input is a non-empty string or list.
Defensive patterns

Strategy: validation

When it happens

Trigger: Triggered when a /v1/embeddings batch request provides an empty 'input'.

Common situations: See trigger scenarios.


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