BerriAI/litellm · error · ValueError

`input` is required on /v1/embeddings batch requests, but wa

Error message

`input` is required on /v1/embeddings batch requests, but was not provided

What it means

Validation while transforming an /v1/embeddings batch entry: the body object contains no 'input', which is the text/content to embed, so the per-row EmbedContentRequest would be empty and the entry is rejected.

Source

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

    Note that `content` is singular (an `EmbedContentRequest`, not a
    `GenerateContentRequest`) and that the `custom_id` round-trips through the top-level
    `key`. An `EmbedContentRequest` returns exactly one vector, so an entry whose `input`
    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

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Include 'input' in the /v1/embeddings batch request body.

Example fix

# add "input": "text to embed" to each request.
Defensive patterns

Strategy: validation

When it happens

Trigger: Triggered when a /v1/embeddings batch request does not include the required 'input' field.

Common situations: See trigger scenarios.


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