langchain-ai/langchain · error · ValueError
Vectorstore has not implemented the delete method
Error message
Vectorstore has not implemented the delete method
What it means
Raised in `index()` preflight when the destination's `delete` method is still the base `VectorStore.delete` implementation. The base class deliberately makes `delete` raise `NotImplementedError`; the check `type(destination).delete == VectorStore.delete` detects subclasses that never overrode it. Running cleanup against such a store would fail mid-indexing, so it fails fast with a `ValueError` instead.
Source
Thrown at libs/core/langchain_core/indexing/api.py:442
destination = vector_store # Renaming internally for clarity
# If it's a vectorstore, let's check if it has the required methods.
if isinstance(destination, VectorStore):
# Check that the Vectorstore has required methods implemented
methods = ["delete", "add_documents"]
for method in methods:
if not hasattr(destination, method):
msg = (
f"Vectorstore {destination} does not have required method {method}"
)
raise ValueError(msg)
if type(destination).delete == VectorStore.delete:
# Checking if the VectorStore has overridden the default delete method
# implementation which just raises a NotImplementedError
msg = "Vectorstore has not implemented the delete method"
raise ValueError(msg)
elif isinstance(destination, DocumentIndex):
pass
else:
msg = ( # type: ignore[unreachable]
f"Vectorstore should be either a VectorStore or a DocumentIndex. "
f"Got {type(destination)}."
)
raise TypeError(msg)
if isinstance(docs_source, BaseLoader):
try:
doc_iterator = docs_source.lazy_load()
except NotImplementedError:
doc_iterator = iter(docs_source.load())
else:
doc_iterator = iter(docs_source)
source_id_assigner = _get_source_id_assigner(source_id_key)View on GitHub (pinned to e32fa9a52e)
Solutions
- Override `delete` in your VectorStore subclass to call the backend's removal API.
- If deletion is unsupported by design, subclass such that indexing is not used, or raise your own descriptive error.
- Check for an updated version of the third-party store package — many added delete support once this check landed.
Example fix
# before
class MyStore(VectorStore):
def add_documents(self, documents, **kwargs): ...
# delete inherited (NotImplementedError)
# after
class MyStore(VectorStore):
def add_documents(self, documents, **kwargs): ...
def delete(self, ids=None, **kwargs):
self._collection.delete(ids=ids)
return True Defensive patterns
Strategy: type-guard
Validate before calling
from langchain_core.vectorstores import VectorStore
if type(store).delete is VectorStore.delete:
raise TypeError("store has not overridden delete(); indexing cleanup would fail")
index(store, docs, rm, cleanup="incremental", source_id_key="source") Type guard
from langchain_core.vectorstores import VectorStore
def has_real_delete(store: VectorStore) -> bool:
return type(store).delete is not VectorStore.delete Prevention
- Always override delete() when subclassing VectorStore for use with indexing.
- When adopting a third-party store, verify delete works before scheduling cleanup jobs.
When it happens
Trigger: Subclassing `VectorStore` (or a mid-tier base like `EmbeddingsStore`) and implementing `add_documents` + `similarity_search` but not `delete`, then calling `index(..., cleanup=...)`. Also triggered by cleanup=None? No — this check runs before cleanup branching in this code path when a VectorStore destination is used with this indexer version.
Common situations: Minimal custom stores built by copying only the search methods from an example; older third-party stores predating the `delete` requirement; wrappers that inherit delete unchanged from an intermediate class that also never implemented it.
Related errors
- The delete operation to VectorStore failed.
- Vectorstore {destination} does not have required method {met
- The delete operation to DocumentIndex failed.
- Vectorstore should be either a VectorStore or a DocumentInde
- Vectorstore should be either a VectorStore or a DocumentInde
AI-assisted analysis of langchain-ai/langchain@e32fa9a52e (2026-08-14).
Data as JSON: /api/errors/abce3e5f76ed7117.
Report an issue: GitHub.