BerriAI/litellm · error · Exception

Failed to create File Search store: {response.text}

Error message

Failed to create File Search store: {response.text}

What it means

Non-200 response from the Gemini File Search create-store POST: the API rejected creating the file-search-capable store, and the full response body is embedded as '{response.text}'. Common causes are an invalid API key, quota limits, or an invalid display name; the response text distinguishes them.

Source

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

        request_body: Final = {"displayName": display_name}

        client: Final = get_async_httpx_client(
            llm_provider=httpxSpecialProvider.RAG,
            params={"timeout": 60.0},
        )
        response: Final = await client.post(
            url,
            json=request_body,
            headers={
                "Content-Type": "application/json",
                "x-goog-api-key": api_key,
            },
        )

        if response.status_code != 200:
            error_msg: Final = f"Failed to create File Search store: {response.text}"
            verbose_logger.error(error_msg)
            raise Exception(error_msg)

        response_data: Final = response.json()
        store_name: Final = response_data.get("name", "")

        verbose_logger.debug("Created File Search store: %s", store_name)
        return store_name

    async def _upload_to_file_search_store(
        self,
        api_key: str,
        base_url: str,
        vector_store_id: str,
        filename: str,
        file_content: bytes,
        content_type: str | None,
    ) -> str:
        """
        Upload a file to Gemini File Search store using resumable upload.

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Check the response text for the API error, verify API key and quotas, and retry.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/rag/ingestion/gemini_ingestion.py:160 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/45b67751c97f1031. Report an issue: GitHub.