mem0ai/mem0 · error · Error

Method 'delete' not available on the provided Langchain Vect

Error message

Method 'delete' not available on the provided Langchain VectorStore client.

What it means

delete() checks typeof store.delete === 'function' before attempting deletion; Langchain's abstract VectorStore interface does not guarantee delete, so adapters without it cannot remove documents. The adapter throws with a console.error rather than silently pretending deletion succeeded — important because silent no-op deletes leak memories.

Source

Thrown at mem0-ts/src/oss/src/vector_stores/langchain.ts:191

        // Langchain's delete often takes its own internal IDs or filter.
        // Attempting deletion via filter is the most likely approach.
        console.warn(
          "LangchainVectorStore: Attempting delete via filter on '_mem0_id'. Success depends on the specific Langchain VectorStore's delete implementation.",
        );
        await (this.lcStore as any).delete({ filter: { _mem0_id: vectorId } });
        // OR if it takes IDs directly (less common for *our* IDs):
        // await (this.lcStore as any).delete({ ids: [vectorId] });
      } catch (e) {
        console.error(
          `LangchainVectorStore: Delete failed. Underlying store's delete method might expect different arguments or filters. Error: ${e}`,
        );
        throw new Error(`Delete failed in underlying Langchain store: ${e}`);
      }
    } else {
      console.error(
        `LangchainVectorStore: The underlying Langchain store instance does not seem to support a 'delete' method.`,
      );
      throw new Error(
        "Method 'delete' not available on the provided Langchain VectorStore client.",
      );
    }
  }

  async list(
    filters?: SearchFilters,
    topK: number = 100,
  ): Promise<[VectorStoreResult[], number]> {
    // No standard list method in Langchain core interface.
    console.error(
      `LangchainVectorStore: The 'list' method is not supported by the generic LangchainVectorStore wrapper.`,
    );
    throw new Error(
      "Method 'list' not supported by LangchainVectorStore wrapper.",
    );
    // Could potentially be implemented if the underlying store has a specific list/scroll/query capability.
  }

View on GitHub (pinned to 001c235229)

Solutions

  1. Use a Langchain store implementation that supports delete (FAISS, Chroma, PGVector, Qdrant adapters).
  2. Implement delete({ filter }) or delete({ ids }) on your custom store class.
  3. Avoid memory-update flows (which delete) with delete-incapable stores.

Example fix

// before
class MyStore { addVectors() {} similaritySearchVectorWithScore() {} }
await store.delete(id); // throws

// after
class MyStore {
  addVectors() {}
  similaritySearchVectorWithScore() {}
  async delete(opts: { filter?: any; ids?: string[] }) { /* remove docs */ }
}
await store.delete(id);
Defensive patterns

Strategy: type-guard

Validate before calling

if (typeof (config.client as any).delete !== 'function') {
  throw new Error('Chosen Langchain store cannot delete; memory updates will fail. Use a delete-capable store.');
}

Type guard

const isDeletableStore = (c: unknown): c is { delete(opts: unknown): Promise<void> } =>
  typeof c === 'object' && c !== null && typeof (c as any).delete === 'function';

Try / catch

try {
  await store.delete(vectorId);
} catch (e) {
  if (e instanceof Error && e.message.includes("'delete' not available")) {
    // cannot be worked around via this wrapper: switch store or implement delete on it
  }
  throw e;
}

Prevention

When it happens

Trigger: Calling store.delete(id) when the wrapped Langchain store class implements addVectors/similaritySearchVectorWithScore but not delete (true for some minimal community stores and custom implementations).

Common situations: Using a lightweight custom or third-party Langchain store for search-only workloads, then wiring it into mem0 where Memory.add() attempts to delete superseded memories; prototyping with MemoryVectorStore variants lacking delete.

Related errors


AI-assisted analysis of mem0ai/mem0@001c235229 (2026-08-15). Data as JSON: /api/errors/bcac4c9ff2822c24. Report an issue: GitHub.