BerriAI/litellm · error · BaseLLMException
{error_message}
Error message
{error_message} What it means
The shared error constructor of BaseVectorStoreConfig: when a vector-store HTTP request (create/query/delete store) returns a non-2xx response, litellm calls get_error_class(), raising BaseLLMException with the provider's message ('{error_message}' is that literal text), status code, and headers. It is the uniform packaging of upstream vector-store failures.
Source
Thrown at litellm/llms/base_llm/vector_store/transformation.py:130
self,
api_base: str | None,
litellm_params: dict,
) -> str:
"""
OPTIONAL
Get the complete url for the request
Some providers need `model` in `api_base`
"""
if api_base is None:
raise ValueError("api_base is required")
return api_base
def get_error_class(self, error_message: str, status_code: int, headers: dict | 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,
optional_params: dict,
request_data: dict,
api_base: str,
api_key: str | None = None,
) -> tuple[dict, bytes | None]:
"""Optionally sign or modify the request before sending.
Providers like AWS Bedrock require SigV4 signing. Providers that don't
require any signing can simply return the headers unchanged and ``None``
for the signed body.View on GitHub (pinned to 6c2dcb801b)
Solutions
- Read status_code + message off the exception to classify: 401/403 -> fix credentials; 404 -> verify vector store id and api_base path; 400 -> validate payload against provider schema.
- Verify api_base for the vector-store deployment points at the correct API route.
- Rotate/refresh credentials and set them via env vars or litellm config rather than hardcoding.
- Wrap calls with retry/backoff for transient 5xx/429 responses.
Example fix
# before
store = litellm.acreate_vector_store(provider="myvdb", create_request=req) # 401 -> BaseLLMException
# after
try:
store = await litellm.acreate_vector_store(provider="myvdb", create_request=req)
except BaseLLMException as e:
if e.status_code in (401, 403):
raise RuntimeError("vector-store auth failed; check VECTOR_STORE_API_KEY") from e
raise Defensive patterns
Strategy: try-catch
Validate before calling
import httpx
# preflight: backend reachable and authorized before CRUD traffic
r = httpx.get(f"{api_base}/health", headers={"Authorization": f"Bearer {api_key}"}, timeout=5)
assert r.status_code < 500, "vector store backend unhealthy" Type guard
def is_vector_store_error(e: BaseException) -> bool:
return getattr(type(e), "__name__", "") == "BaseLLMException" and hasattr(e, "status_code") Try / catch
try:
store = await litellm.acreate_vector_store(provider=p, create_request=req)
except BaseLLMException as e:
if e.status_code in (401, 403):
refresh_provider_credentials(p)
elif e.status_code == 404:
raise RuntimeError(f"api_base route wrong for {p}") from e
else:
raise Prevention
- Health-check vector-store backends before serving traffic.
- Alert on repeated 4xx from vector stores — usually credential drift or route changes.
When it happens
Trigger: Any vector-store operation whose upstream call fails: invalid/missing credentials (401), nonexistent vector store id (404), malformed create payload (400), quota limits (429), or service down (5xx) — e.g. litellm.acreate_vector_store against a misconfigured Pinecone/LlamaIndex-compatible backend.
Common situations: Expired or wrong VECTOR_STORE_API_KEY; wrong api_base pointing at a non-vector-store route (404s); payload schema drift after provider API changes; proxy auth headers missing.
Related errors
AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15).
Data as JSON: /api/errors/fde567c15e89fcc4.
Report an issue: GitHub.