BerriAI/litellm · error · Exception

Failed to create RAG corpus: {response.text}

Error message

Failed to create RAG corpus: {response.text}

What it means

Raised when the Vertex AI RAG createCorpus HTTP call returns a status other than 200/201; the raw Vertex AI error body is embedded, indicating a project/permission/API-enablement problem on the provider side rather than a local validation failure.

Source

Thrown at litellm/rag/ingestion/vertex_ai_ingestion.py:191

        verbose_logger.debug("Request body: %s", json.dumps(request_body, indent=2))

        client: Final = get_async_httpx_client(
            llm_provider=httpxSpecialProvider.RAG,
            params={"timeout": 60.0},
        )

        response: Final = await client.post(
            url,
            json=request_body,
            headers={
                "Authorization": f"Bearer {access_token}",
                "Content-Type": "application/json",
            },
        )
        if response.status_code not in [200, 201]:
            error_msg: Final = f"Failed to create RAG corpus: {response.text}"
            verbose_logger.error(error_msg)
            raise Exception(error_msg)

        response_data: Final = response.json()
        verbose_logger.debug("Create corpus response: %s", json.dumps(response_data, indent=2))

        # The response is a long-running operation
        # Check if it's already done or if we need to poll
        if response_data.get("done"):
            # Operation completed immediately
            corpus_name = response_data.get("response", {}).get("name", "")
        else:
            # Need to poll the operation
            operation_name: Final = response_data.get("name", "")
            verbose_logger.debug("Polling operation: %s", operation_name)
            corpus_name = await self._poll_operation(
                operation_name=operation_name,
                access_token=access_token,
            )

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Check the response text for the API error; verify Vertex credentials, project, and region.
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at litellm/rag/ingestion/vertex_ai_ingestion.py:191 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/90d8f5e4cd822d79. Report an issue: GitHub.