BerriAI/litellm · error · ValueError

vector_store_id is required when ingesting an existing file_

Error message

vector_store_id is required when ingesting an existing file_id

What it means

Input guard in the OpenAI ingestion flow: an existing OpenAI file_id was supplied to attach to a vector store, but no vector_store_id was configured, so there is nowhere to attach the file. Provide vector_store_id in the vector store config, or upload fresh file data instead.

Source

Thrown at litellm/rag/ingestion/openai_ingestion.py:90

            file_content: Raw file bytes
            filename: Name of the file
            content_type: MIME type
            chunks: Ignored - OpenAI handles chunking
            embeddings: Ignored - OpenAI handles embedding
            existing_file_id: Existing OpenAI file ID to attach

        Returns:
            Tuple of (vector_store_id, file_id)
        """
        vector_store_id = self.vector_store_config.get("vector_store_id")
        ttl_days: Final = self.vector_store_config.get("ttl_days")

        # Get credentials from vector_store_config (loaded from litellm_credential_name if provided)
        api_key: Final = self.vector_store_config.get("api_key")
        api_base: Final = self.vector_store_config.get("api_base")

        if existing_file_id and not vector_store_id:
            raise ValueError("vector_store_id is required when ingesting an existing file_id")

        # Create vector store if not provided
        if not vector_store_id:
            expires_after: Final = {"anchor": "last_active_at", "days": ttl_days} if ttl_days else None
            create_response: Final = await vector_store_acreate(
                name=self.ingest_name or "litellm-rag-ingest",
                custom_llm_provider="openai",
                expires_after=expires_after,
                api_key=api_key,
                api_base=api_base,
            )
            vector_store_id = create_response.get("id")

        if existing_file_id and vector_store_id:
            await vector_store_file_acreate(
                vector_store_id=vector_store_id,
                file_id=existing_file_id,
                custom_llm_provider="openai",

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Provide vector_store_id when ingesting an existing OpenAI file_id.
Defensive patterns

Strategy: validation

When it happens

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