BerriAI/litellm · error · VertexAIError

Vertex AI batch creation requires the model to be part of `i

Error message

Vertex AI batch creation requires the model to be part of `input_file_id`, but '{gcs_file_uri}' contains no 'publishers/<publisher>/models/<model>' path segment. Either upload the input file through LiteLLM (POST /v1/files with custom_llm_provider=vertex_ai), which encodes the model into the returned file id, or pass a uri of the form gs://<bucket>/<prefix>/publishers/<publisher>/models/<model>/<file>

What it means

Error "Vertex AI batch creation requires the model to be part of `input_file_id`, but '{gcs_file_uri}' contains no 'publishers/<publisher>/models/<model>' path segment. Either upload the input file through LiteLLM (POST /v1/files with custom_llm_provider=vertex_ai), which encodes the model into the returned file id, or pass a uri of the form gs://<bucket>/<prefix>/publishers/<publisher>/models/<model>/<file>" thrown in BerriAI/litellm.

Source

Thrown at litellm/llms/vertex_ai/batches/transformation.py:209

    @classmethod
    def _get_model_from_gcs_file(cls, gcs_file_uri: str) -> str:
        """
        Extracts the model from the gcs file uri

        When files are uploaded using LiteLLM (/v1/files), the model is stored in the gcs file uri

        Why?
        - Because Vertex Requires the `model` param in create batch jobs request, but OpenAI does not require this


        gcs_file_uri format: gs://litellm-testing-bucket/litellm-vertex-files/publishers/google/models/gemini-1.5-flash-001/e9412502-2c91-42a6-8e61-f5c294cc0fc8
        returns: "publishers/google/models/gemini-1.5-flash-001"

        Raises a 400 `VertexAIError` when the uri carries no parseable model path.
        """
        model: Final = cls._parse_model_from_gcs_file(gcs_file_uri)
        if model is None:
            raise VertexAIError(
                status_code=400,
                message=(
                    "Vertex AI batch creation requires the model to be part of `input_file_id`, but "
                    f"'{gcs_file_uri}' contains no 'publishers/<publisher>/models/<model>' path segment. "
                    "Either upload the input file through LiteLLM (POST /v1/files with "
                    "custom_llm_provider=vertex_ai), which encodes the model into the returned file id, or "
                    "pass a uri of the form "
                    "gs://<bucket>/<prefix>/publishers/<publisher>/models/<model>/<file>"
                ),
            )
        return model

    @classmethod
    def _parse_model_from_gcs_file(cls, gcs_file_uri: str) -> str | None:
        """
        Returns the `publishers/<publisher>/models/<model>` path from a gcs uri, or None if the uri
        does not contain one.
        """

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Upload the input file through LiteLLM so the model is encoded into the file id.
  2. Or pass a gs:// uri containing publishers/<publisher>/models/<model>/<file>.

Example fix

# uri like gs://bucket/prefix/publishers/google/models/gemini-1.5-pro/file.jsonl
Defensive patterns

Strategy: validation

When it happens

Trigger: Triggered when the Vertex AI batch input_file_id GCS URI contains no publishers/<publisher>/models/<model> segment.

Common situations: See trigger scenarios.


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