{"record":{"id":"9c437396a5bb7c6c","repo":"langchain-ai/langchain","slug":"vectorstore-has-not-implemented-the-adelete-or-del","errorCode":null,"errorMessage":"Vectorstore has not implemented the adelete or delete method","messagePattern":"Vectorstore has not implemented the adelete or delete method","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"libs/core/langchain_core/indexing/api.py","lineNumber":785,"sourceCode":"        # Check that the Vectorstore has required methods implemented\n        # Check that the Vectorstore has required methods implemented\n        methods = [\"adelete\", \"aadd_documents\"]\n\n        for method in methods:\n            if not hasattr(destination, method):\n                msg = (\n                    f\"Vectorstore {destination} does not have required method {method}\"\n                )\n                raise ValueError(msg)\n\n        if (\n            type(destination).adelete == VectorStore.adelete\n            and type(destination).delete == VectorStore.delete\n        ):\n            # Checking if the VectorStore has overridden the default adelete or delete\n            # methods implementation which just raises a NotImplementedError\n            msg = \"Vectorstore has not implemented the adelete or delete method\"\n            raise ValueError(msg)\n    elif isinstance(destination, DocumentIndex):\n        pass\n    else:\n        msg = (  # type: ignore[unreachable]\n            f\"Vectorstore should be either a VectorStore or a DocumentIndex. \"\n            f\"Got {type(destination)}.\"\n        )\n        raise TypeError(msg)\n    async_doc_iterator: AsyncIterator[Document]\n    if isinstance(docs_source, BaseLoader):\n        try:\n            async_doc_iterator = docs_source.alazy_load()\n        except NotImplementedError:\n            # Exception triggered when neither lazy_load nor alazy_load are implemented.\n            # * The default implementation of alazy_load uses lazy_load.\n            # * The default implementation of lazy_load raises NotImplementedError.\n            # In such a case, we use the load method and convert it to an async\n            # iterator.","sourceCodeStart":767,"sourceCodeEnd":803,"githubUrl":"https://github.com/langchain-ai/langchain/blob/e32fa9a52eab3b61ad7a45399bfde59b3e580fc4/libs/core/langchain_core/indexing/api.py#L767-L803","documentation":"`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).","triggerScenarios":"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`.","commonSituations":"Older third-party vector store integrations written before deletion was standardized; quick custom stores in notebooks; using `VectorStore` directly or a trivially-subclassed placeholder.","solutions":["Implement `delete` and/or `adelete` on your store class to actually remove documents by ID.","Upgrade the integration package — maintained stores (Chroma, FAISS, PGVector, etc.) already override these; you may be on a stale version or a homegrown wrapper.","If deletion is impossible in your backend, run indexing with `cleanup=None` and manage staleness yourself."],"exampleFix":"# before\nclass MyStore(VectorStore):\n    def add_texts(self, texts, metadatas=None, **kw): ...\n    # no delete implementation\n\n# after\nclass MyStore(VectorStore):\n    def add_texts(self, texts, metadatas=None, **kw): ...\n    def delete(self, ids=None, **kw):\n        self._collection.delete(ids=ids)","handlingStrategy":"validation","validationCode":"from langchain_core.vectorstores import VectorStore\n\ndeletes_implemented = not (\n    type(vs).adelete is VectorStore.adelete and type(vs).delete is VectorStore.delete\n)\nassert deletes_implemented, \"override delete or adelete before indexing with cleanup\"","typeGuard":"from langchain_core.vectorstores import VectorStore\n\ndef supports_deletion(vs: VectorStore) -> bool:\n    \"\"\"True when the store overrides delete/adelete (not base NotImplementedError stubs).\"\"\"\n    return not (\n        type(vs).adelete is VectorStore.adelete\n        and type(vs).delete is VectorStore.delete\n    )","tryCatchPattern":"null","preventionTips":["Implement delete/adelete in every custom VectorStore subclass","Keep integration packages updated — maintained stores override deletion","If deletion is unsupported, use cleanup=None and manage staleness yourself"],"tags":["indexing","vector-store","not-implemented"],"backgroundTag":null,"analyzedSha":"e32fa9a52eab3b61ad7a45399bfde59b3e580fc4","analyzedAt":"2026-08-14T18:42:09.092Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}