BerriAI/litellm · error · ValueError

Must provide file_data, file_url, or file_id

Error message

Must provide file_data, file_url, or file_id

What it means

Input-source guard in the RAG upload flow: none of file_data (tuple), file_url, or file_id was provided, so there is no document to ingest. The endpoint requires exactly one source; supply inline file data, a fetchable URL, or a previously uploaded file id.

Source

Thrown at litellm/rag/ingestion/base_ingestion.py:134

            Tuple of (filename, file_content, content_type, existing_file_id)
        """
        if file_data:
            filename, file_content, content_type = file_data
            return filename, file_content, content_type, None

        if file_url:
            http_client: Final = get_async_httpx_client(llm_provider=httpxSpecialProvider.RAG)
            response: Final = await async_safe_get(http_client, file_url)
            response.raise_for_status()
            file_content = response.content
            filename = file_url.split("/")[-1] or "document"
            content_type = response.headers.get("content-type", "application/octet-stream")
            return filename, file_content, content_type, None

        if file_id:
            return None, None, None, file_id

        raise ValueError("Must provide file_data, file_url, or file_id")

    async def ocr(
        self,
        file_content: bytes | None,
        content_type: str | None,
    ) -> str | None:
        """
        Perform OCR on file content to extract text.

        Args:
            file_content: Raw file bytes
            content_type: MIME type of the file

        Returns:
            Extracted text or None if OCR not configured/needed
        """
        if not self.ocr_config or not file_content:
            return None

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Provide one of file_data, file_url, or file_id in the ingestion request.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/rag/ingestion/base_ingestion.py:134 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/bed853c306886215. Report an issue: GitHub.