{"record":{"id":"38ff293769904270","repo":"BerriAI/litellm","slug":"vertex-ai-batch-creation-requires-the-model-to-be","errorCode":null,"errorMessage":"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>","messagePattern":"Vertex AI batch creation requires the model to be part of `input_file_id`, but '(.+?)' 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>","errorType":"http","errorClass":"VertexAIError","httpStatus":400,"severity":"error","filePath":"litellm/llms/vertex_ai/batches/transformation.py","lineNumber":209,"sourceCode":"    @classmethod\n    def _get_model_from_gcs_file(cls, gcs_file_uri: str) -> str:\n        \"\"\"\n        Extracts the model from the gcs file uri\n\n        When files are uploaded using LiteLLM (/v1/files), the model is stored in the gcs file uri\n\n        Why?\n        - Because Vertex Requires the `model` param in create batch jobs request, but OpenAI does not require this\n\n\n        gcs_file_uri format: gs://litellm-testing-bucket/litellm-vertex-files/publishers/google/models/gemini-1.5-flash-001/e9412502-2c91-42a6-8e61-f5c294cc0fc8\n        returns: \"publishers/google/models/gemini-1.5-flash-001\"\n\n        Raises a 400 `VertexAIError` when the uri carries no parseable model path.\n        \"\"\"\n        model: Final = cls._parse_model_from_gcs_file(gcs_file_uri)\n        if model is None:\n            raise VertexAIError(\n                status_code=400,\n                message=(\n                    \"Vertex AI batch creation requires the model to be part of `input_file_id`, but \"\n                    f\"'{gcs_file_uri}' contains no 'publishers/<publisher>/models/<model>' path segment. \"\n                    \"Either upload the input file through LiteLLM (POST /v1/files with \"\n                    \"custom_llm_provider=vertex_ai), which encodes the model into the returned file id, or \"\n                    \"pass a uri of the form \"\n                    \"gs://<bucket>/<prefix>/publishers/<publisher>/models/<model>/<file>\"\n                ),\n            )\n        return model\n\n    @classmethod\n    def _parse_model_from_gcs_file(cls, gcs_file_uri: str) -> str | None:\n        \"\"\"\n        Returns the `publishers/<publisher>/models/<model>` path from a gcs uri, or None if the uri\n        does not contain one.\n        \"\"\"","sourceCodeStart":191,"sourceCodeEnd":227,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/vertex_ai/batches/transformation.py#L191-L227","documentation":"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.","triggerScenarios":"Triggered when the Vertex AI batch input_file_id GCS URI contains no publishers/<publisher>/models/<model> segment.","commonSituations":"See trigger scenarios.","solutions":["Upload the input file through LiteLLM so the model is encoded into the file id.","Or pass a gs:// uri containing publishers/<publisher>/models/<model>/<file>."],"exampleFix":"# uri like gs://bucket/prefix/publishers/google/models/gemini-1.5-pro/file.jsonl","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}