langchain-ai/langchain · error · IndexingException

The delete operation to VectorStore failed.

Error message

The delete operation to VectorStore failed.

What it means

Raised by the internal `_delete` helper in `langchain_core.indexing.api` during cleanup phases of `index()`. When the destination is a `VectorStore`, `VectorStore.delete(ids)` may return a success flag; a return value of exactly `False` (as opposed to None, which is treated as success) means the store itself reported the delete failed, and an `IndexingException` wraps that failure.

Source

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

    vector_store: VectorStore | DocumentIndex,
    ids: list[str],
) -> None:
    """Delete documents from a vector store or document index by their IDs.

    Args:
        vector_store: The vector store or document index to delete from.
        ids: List of document IDs to delete.

    Raises:
        IndexingException: If the delete operation fails.
        TypeError: If the `vector_store` is neither a `VectorStore` nor a
            `DocumentIndex`.
    """
    if isinstance(vector_store, VectorStore):
        delete_ok = vector_store.delete(ids)
        if delete_ok is not None and delete_ok is False:
            msg = "The delete operation to VectorStore failed."
            raise IndexingException(msg)
    elif isinstance(vector_store, DocumentIndex):
        delete_response = vector_store.delete(ids)
        if "num_failed" in delete_response and delete_response["num_failed"] > 0:
            msg = "The delete operation to DocumentIndex failed."
            raise IndexingException(msg)
    else:
        msg = (  # type: ignore[unreachable]
            f"Vectorstore should be either a VectorStore or a DocumentIndex. "
            f"Got {type(vector_store)}."
        )
        raise TypeError(msg)


# PUBLIC API


class IndexingResult(TypedDict):
    """Return a detailed a breakdown of the result of the indexing operation."""

View on GitHub (pinned to e32fa9a52e)

Solutions

  1. Inspect the vector store directly (list/get the collection, run `store.delete([...])` manually) to find why it returns False.
  2. Verify the collection name and that documents with those IDs exist before cleanup runs.
  3. If you control the store subclass, return None on success or raise with detail instead of returning False.

Example fix

# before (custom store)
class MyStore(VectorStore):
    def delete(self, ids):
        return self._http_delete(ids)  # False on any hiccup

# after
class MyStore(VectorStore):
    def delete(self, ids):
        ok = self._http_delete(ids)
        if not ok:
            raise RuntimeError(f"delete failed for ids={ids}")
        return True
Defensive patterns

Strategy: try-catch

Type guard

from langchain_core.indexing.api import IndexingException  # conceptually
# preflight: confirm delete works
probe_ids = [d.id for d in docs[:1]]
ok = store.delete(probe_ids)
if ok is False:
    raise RuntimeError("store.delete returned False; fix store before indexing")

Try / catch

from langchain_core.indexing import IndexingException

try:
    index(vs, docs, rm, cleanup="incremental", source_id_key="source")
except IndexingException as e:
    logger.error("Cleanup delete failed, store may be unhealthy: %s", e)
    alert_ops()  # do not blind-retry; inspect store first

Prevention

When it happens

Trigger: Running `index(..., cleanup="full"|"incremental"|"scoped_full")` where the vector store's `delete()` returns False — e.g. collection not found, IDs missing, or a store-side error swallowed into a boolean.

Common situations: Vector store collections deleted or renamed out-of-band; permission/network issues on the store that surface as False; custom VectorStore subclasses returning False on partial failure.

Related errors


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