BerriAI/litellm · error · BaseLLMException

{error_message}

Error message

{error_message}

What it means

BaseVectorStoreFilesConfig.get_error_class() is the uniform error wrapper for vector-store-file HTTP failures: it raises BaseLLMException constructed from the provider's error text ('{error_message}' is that text verbatim), status code, and headers. Seeing it means the underlying create/get/delete-file request to the vector-store backend returned an error response.

Source

Thrown at litellm/llms/base_llm/vector_store_files/transformation.py:189

    ) -> tuple[str, dict[str, Any]]: ...

    @abstractmethod
    def transform_delete_vector_store_file_response(
        self,
        *,
        response: httpx.Response,
    ) -> VectorStoreFileDeleteResponse: ...

    def get_error_class(
        self,
        *,
        error_message: str,
        status_code: int,
        headers: dict[str, Any] | httpx.Headers,
    ) -> BaseLLMException:
        from ..chat.transformation import BaseLLMException

        raise BaseLLMException(
            status_code=status_code,
            message=error_message,
            headers=headers,
        )

    def sign_request(
        self,
        *,
        headers: dict[str, str],
        optional_params: dict[str, Any],
        request_data: dict[str, Any],
        api_base: str,
        api_key: str | None = None,
    ) -> tuple[dict[str, str], bytes | None]:
        return headers, None

    def prepare_chunking_strategy(
        self,

View on GitHub (pinned to 6c2dcb801b)

Solutions

  1. Inspect the exception's status_code and message to pinpoint: 404 -> re-fetch valid vector_store_id; 400 -> fix file payload/metadata; 401 -> refresh credentials.
  2. Validate vector_store_id exists (list stores) before file operations.
  3. Confirm the api_base route serves the vector-store-files API of your backend version.
  4. Retry transient 429/5xx with backoff (litellm num_retries or router).

Example fix

# before
file = await litellm.acreate_vector_store_file(
    vector_store_id="vs_deleted", provider="myvdb", create_request=body,
)  # 404 -> BaseLLMException

# after
stores = await litellm.alist_vector_stores(provider="myvdb")
if "vs_deleted" not in [s.id for s in stores]:
    raise ValueError("vector store no longer exists")
file = await litellm.acreate_vector_store_file(
    vector_store_id="vs_deleted", provider="myvdb", create_request=body,
)
Defensive patterns

Strategy: try-catch

Validate before calling

stores = await litellm.alist_vector_stores(provider=p, litellm_params=params)
assert vector_store_id in {s.id for s in stores}, f"unknown vector_store_id {vector_store_id}"

Type guard

def is_vector_store_file_error(e: BaseException) -> bool:
    return hasattr(e, "status_code") and hasattr(e, "message")

Try / catch

try:
    f = await litellm.acreate_vector_store_file(vector_store_id=vid, provider=p, create_request=body)
except BaseLLMException as e:
    if e.status_code == 404:
        vid = await recreate_store_and_get_id(p)
        f = await litellm.acreate_vector_store_file(vector_store_id=vid, provider=p, create_request=body)
    else:
        raise

Prevention

When it happens

Trigger: File-level vector-store ops failing upstream: uploading/attaching a file to a nonexistent store id (404), oversized or malformed file payload (400), auth failures (401/403), provider rate limits (429).

Common situations: Stale vector_store_id after the store was deleted; file size/content-type rejected by the backend; rotated API keys not updated; backend route drift after a provider SDK upgrade.

Related errors


AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15). Data as JSON: /api/errors/9518f0bbc9c135e0. Report an issue: GitHub.