BerriAI/litellm · error · Exception

No upload URL returned in response headers

Error message

No upload URL returned in response headers

What it means

Protocol guard after a successful upload-initiation response: the Gemini Files API did not return the X-Goog-Upload-URL header (or it was empty), so there is no destination URL for the file bytes. Usually indicates an API change or an unexpected response shape; the logged headers show what came back.

Source

Thrown at litellm/rag/ingestion/gemini_ingestion.py:282

        client: Final = get_async_httpx_client(
            llm_provider=httpxSpecialProvider.RAG,
            params={"timeout": 60.0},
        )
        response: Final = await client.post(
            url,
            json=request_body,
            headers=headers,
        )

        if response.status_code not in [200, 201]:
            error_msg: Final = f"Failed to initiate upload: {response.text}"
            verbose_logger.error(error_msg)
            raise Exception(error_msg)
        verbose_logger.debug("Initiate resumable upload response: %s", response.headers)
        # Extract upload URL from response headers
        upload_url: Final = response.headers.get("x-goog-upload-url")
        if not upload_url:
            raise Exception("No upload URL returned in response headers")

        verbose_logger.debug("Got upload URL: %s", upload_url)
        return upload_url

    async def _upload_file_content(
        self,
        upload_url: str,
        file_content: bytes,
    ) -> str:
        """
        Upload file content to the resumable upload URL.

        Returns:
            File ID or document name from the response
        """
        headers: Final = {
            "Content-Length": str(len(file_content)),
            "X-Goog-Upload-Offset": "0",

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Retry the upload initiation; if persistent, verify the Gemini File Search API version and endpoint.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/rag/ingestion/gemini_ingestion.py:282 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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