BerriAI/litellm · error · ValueError

Failed to download file from GCS: {decoded_file_id}

Error message

Failed to download file from GCS: {decoded_file_id}

What it means

Raised when the GCS download of a Vertex AI file object fails: the decoded file_id (bucket/object path) is embedded. Fires when the object does not exist, credentials lack storage access, or the bucket/object extraction produced an invalid target.

Source

Thrown at litellm/llms/vertex_ai/files/handler.py:155

        )
        bucket_name, object_path = self._extract_bucket_and_object_from_file_id(
            file_id=file_id,
            configured_bucket_name=gcs_logging_config["bucket_name"],
            litellm_params=litellm_params,
        )

        download_kwargs: Final = {
            "standard_callback_dynamic_params": {
                "gcs_bucket_name": bucket_name,
                "gcs_path_service_account": gcs_logging_config["path_service_account"],
            }
        }

        file_content: Final = await self.download_gcs_object(object_name=object_path, **download_kwargs)
        decoded_file_id: Final = unquote(file_id)

        if file_content is None:
            raise ValueError(f"Failed to download file from GCS: {decoded_file_id}")

        mock_response: Final = httpx.Response(
            status_code=200,
            content=file_content,
            headers={
                "content-type": "application/octet-stream",
                "content-length": str(len(file_content)),
            },
            request=httpx.Request(method="GET", url=decoded_file_id),
        )

        # Apply transformation to convert Vertex AI batch outputs to OpenAI format
        config: Final = VertexAIFilesConfig()

        # Create a logging object for transformation
        logging_obj: Final = Logging(
            model="",
            messages=[],

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Verify the GCS object exists and credentials have read access.
  2. Check that the decoded file id maps to a valid gs:// path.

Example fix

# test access: gsutil cat gs://bucket/object with the same service account.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Triggered when downloading a file from GCS fails for the decoded file_id.

Common situations: See trigger scenarios.


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