langchain-ai/langchain · error · ValueError

Vectorstore has not implemented the adelete or delete method

Error message

Vectorstore has not implemented the adelete or delete method

What it means

`ValueError` from indexing validation: the passed `VectorStore` inherits the default `adelete` and `delete` implementations unchanged. The defaults on `VectorStore` just raise `NotImplementedError`, so an indexing run with cleanup would crash mid-flight; validation fails fast instead. Both the sync and async variants must be overridden (the check rejects only when *neither* is overridden — if either `adelete` or `delete` is overridden, the pair of comparisons is False and the store passes).

Source

Thrown at libs/core/langchain_core/indexing/api.py:785

        # Check that the Vectorstore has required methods implemented
        # Check that the Vectorstore has required methods implemented
        methods = ["adelete", "aadd_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).adelete == VectorStore.adelete
            and type(destination).delete == VectorStore.delete
        ):
            # Checking if the VectorStore has overridden the default adelete or delete
            # methods implementation which just raises a NotImplementedError
            msg = "Vectorstore has not implemented the adelete or 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)
    async_doc_iterator: AsyncIterator[Document]
    if isinstance(docs_source, BaseLoader):
        try:
            async_doc_iterator = docs_source.alazy_load()
        except NotImplementedError:
            # Exception triggered when neither lazy_load nor alazy_load are implemented.
            # * The default implementation of alazy_load uses lazy_load.
            # * The default implementation of lazy_load raises NotImplementedError.
            # In such a case, we use the load method and convert it to an async
            # iterator.

View on GitHub (pinned to e32fa9a52e)

Solutions

  1. Implement `delete` and/or `adelete` on your store class to actually remove documents by ID.
  2. Upgrade the integration package — maintained stores (Chroma, FAISS, PGVector, etc.) already override these; you may be on a stale version or a homegrown wrapper.
  3. If deletion is impossible in your backend, run indexing with `cleanup=None` and manage staleness yourself.

Example fix

# before
class MyStore(VectorStore):
    def add_texts(self, texts, metadatas=None, **kw): ...
    # no delete implementation

# after
class MyStore(VectorStore):
    def add_texts(self, texts, metadatas=None, **kw): ...
    def delete(self, ids=None, **kw):
        self._collection.delete(ids=ids)
Defensive patterns

Strategy: validation

Validate before calling

from langchain_core.vectorstores import VectorStore

deletes_implemented = not (
    type(vs).adelete is VectorStore.adelete and type(vs).delete is VectorStore.delete
)
assert deletes_implemented, "override delete or adelete before indexing with cleanup"

Type guard

from langchain_core.vectorstores import VectorStore

def supports_deletion(vs: VectorStore) -> bool:
    """True when the store overrides delete/adelete (not base NotImplementedError stubs)."""
    return not (
        type(vs).adelete is VectorStore.adelete
        and type(vs).delete is VectorStore.delete
    )

Try / catch

null

Prevention

When it happens

Trigger: Passing a `VectorStore` subclass that implements `add_texts`/similarity search but never overrides `adelete` or `delete`, with any cleanup mode (or duplicate documents forcing deletion). Triggered exactly when `type(destination).adelete == VectorStore.adelete and type(destination).delete == VectorStore.delete`.

Common situations: Older third-party vector store integrations written before deletion was standardized; quick custom stores in notebooks; using `VectorStore` directly or a trivially-subclassed placeholder.

Related errors


AI-assisted analysis of langchain-ai/langchain@e32fa9a52e (2026-08-14). Data as JSON: /api/errors/9c437396a5bb7c6c. Report an issue: GitHub.