{"record":{"id":"09d5ed9352aaaa4b","repo":"BerriAI/litellm","slug":"vector-store-with-id-data-vector-store-id-not-fo","errorCode":null,"errorMessage":"Vector store with ID {data.vector_store_id} not found","messagePattern":"Vector store with ID (.+?) not found","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"error","filePath":"enterprise/litellm_enterprise/proxy/vector_stores/endpoints.py","lineNumber":221,"sourceCode":"    Delete a vector store.\n\n    Parameters:\n    - vector_store_id: str - ID of the vector store to delete\n    \"\"\"\n    from litellm.proxy.proxy_server import prisma_client\n\n    if prisma_client is None:\n        raise HTTPException(status_code=500, detail=\"Database not connected\")\n\n    try:\n        # Check if vector store exists\n        existing_vector_store = (\n            await prisma_client.db.litellm_managedvectorstorestable.find_unique(\n                where={\"vector_store_id\": data.vector_store_id}\n            )\n        )\n        if existing_vector_store is None:\n            raise HTTPException(\n                status_code=404,\n                detail=f\"Vector store with ID {data.vector_store_id} not found\",\n            )\n\n        # Delete vector store\n        await prisma_client.db.litellm_managedvectorstorestable.delete(\n            where={\"vector_store_id\": data.vector_store_id}\n        )\n\n        # Delete vector store from registry\n        if litellm.vector_store_registry is not None:\n            litellm.vector_store_registry.delete_vector_store_from_registry(\n                vector_store_id=data.vector_store_id\n            )\n\n        return {\"message\": f\"Vector store {data.vector_store_id} deleted successfully\"}\n    except Exception as e:\n        raise HTTPException(status_code=500, detail=str(e))","sourceCodeStart":203,"sourceCodeEnd":239,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/enterprise/litellm_enterprise/proxy/vector_stores/endpoints.py#L203-L239","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","solutions":["List vector stores to confirm the exact current vector_store_id before deleting","Treat 404 on delete as success in idempotent cleanup code (resource already gone)","Verify you are pointed at the right environment's proxy/database","Check for typos, extra whitespace, and URL-encoding issues in the ID"],"exampleFix":"# before\nPOST /vector_store/delete {\"vector_store_id\": \"openai-dosc\"}  # typo -> 404\n\n# after\nPOST /vector_store/delete {\"vector_store_id\": \"openai-docs\"}  # correct ID\n\n# idempotent delete\ntry:\n    delete_vector_store(\"openai-docs\")\nexcept httpx.HTTPStatusError as e:\n    if e.response.status_code != 404:\n        raise  # 404 = already gone, fine","handlingStrategy":"try-catch","validationCode":"import httpx\n\ndef safe_delete_vector_store(client: httpx.Client, vector_store_id: str) -> str:\n    info = client.post(\"/vector_store/info\", json={\"vector_store_id\": vector_store_id})\n    if info.status_code == 404:\n        return \"already-gone\"  # nothing to delete\n    info.raise_for_status()\n    return \"exists\"","typeGuard":null,"tryCatchPattern":"try:\n    client.post(\"/vector_store/delete\", json={\"vector_store_id\": sid}).raise_for_status()\nexcept httpx.HTTPStatusError as e:\n    if e.response.status_code == 404:\n        pass  # idempotent: already deleted\n    else:\n        raise","preventionTips":["Treat delete-404 as success in cleanup scripts; only propagate other errors","Track created vector store IDs in your provisioner so you never delete guessed IDs","Namespace IDs per environment and record them in IaC/state to avoid cross-env mistakes"],"tags":["vector-store","not-found","http-404","delete","idempotency"],"backgroundTag":"resource-not-found","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}