BerriAI/litellm · error · HTTPException

Vector store with ID {data.vector_store_id} not found

Error message

Vector store with ID {data.vector_store_id} not found

What it means

HTTPException 404 from the delete-vector-store endpoint when find_unique on litellm_managedvectorstorestable returns None for the requested vector_store_id. The row must exist in the DB before it can be deleted (and removed from litellm.vector_store_registry).

Source

Thrown at enterprise/litellm_enterprise/proxy/vector_stores/endpoints.py:221

    Delete a vector store.

    Parameters:
    - vector_store_id: str - ID of the vector store to delete
    """
    from litellm.proxy.proxy_server import prisma_client

    if prisma_client is None:
        raise HTTPException(status_code=500, detail="Database not connected")

    try:
        # Check if vector store exists
        existing_vector_store = (
            await prisma_client.db.litellm_managedvectorstorestable.find_unique(
                where={"vector_store_id": data.vector_store_id}
            )
        )
        if existing_vector_store is None:
            raise HTTPException(
                status_code=404,
                detail=f"Vector store with ID {data.vector_store_id} not found",
            )

        # Delete vector store
        await prisma_client.db.litellm_managedvectorstorestable.delete(
            where={"vector_store_id": data.vector_store_id}
        )

        # Delete vector store from registry
        if litellm.vector_store_registry is not None:
            litellm.vector_store_registry.delete_vector_store_from_registry(
                vector_store_id=data.vector_store_id
            )

        return {"message": f"Vector store {data.vector_store_id} deleted successfully"}
    except Exception as e:
        raise HTTPException(status_code=500, detail=str(e))

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. List vector stores to confirm the exact current vector_store_id before deleting
  2. Treat 404 on delete as success in idempotent cleanup code (resource already gone)
  3. Verify you are pointed at the right environment's proxy/database
  4. Check for typos, extra whitespace, and URL-encoding issues in the ID

Example fix

# before
POST /vector_store/delete {"vector_store_id": "openai-dosc"}  # typo -> 404

# after
POST /vector_store/delete {"vector_store_id": "openai-docs"}  # correct ID

# idempotent delete
try:
    delete_vector_store("openai-docs")
except httpx.HTTPStatusError as e:
    if e.response.status_code != 404:
        raise  # 404 = already gone, fine
Defensive patterns

Strategy: try-catch

Validate before calling

import httpx

def safe_delete_vector_store(client: httpx.Client, vector_store_id: str) -> str:
    info = client.post("/vector_store/info", json={"vector_store_id": vector_store_id})
    if info.status_code == 404:
        return "already-gone"  # nothing to delete
    info.raise_for_status()
    return "exists"

Try / catch

try:
    client.post("/vector_store/delete", json={"vector_store_id": sid}).raise_for_status()
except httpx.HTTPStatusError as e:
    if e.response.status_code == 404:
        pass  # idempotent: already deleted
    else:
        raise

Prevention

When it happens

Trigger: POST /vector_store/delete with an unknown/typo'd vector_store_id; double-submitting a delete (first succeeds, second 404s); deleting a store that was created in a different database/environment; store ID containing whitespace or wrong casing.

Common situations: Cleanup scripts running after someone already deleted the store; environments (staging vs prod) sharing code but not data; UI allowing delete on stale list entries.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/09d5ed9352aaaa4b. Report an issue: GitHub.