mem0ai/mem0 · error · Error

Method 'update' not supported by LangchainVectorStore wrappe

Error message

Method 'update' not supported by LangchainVectorStore wrapper.

What it means

update() is deliberately unimplemented: most Langchain stores have no in-place update, the canonical pattern being delete-then-add. The adapter throws rather than performing an incorrect partial mutation.

Source

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

    );
    throw new Error(
      "Method 'get' not reliably supported by LangchainVectorStore wrapper.",
    );
    // Potential (inefficient) simulation:
    // Perform a search with a filter like { _mem0_id: vectorId }, limit 1.
    // This requires the underlying store to support filtering on _mem0_id.
  }

  async update(
    vectorId: string,
    vector: number[],
    payload: Record<string, any>,
  ): Promise<void> {
    // Updates often require delete + add in Langchain.
    console.error(
      `LangchainVectorStore: The 'update' method is not directly supported. Use delete followed by insert.`,
    );
    throw new Error(
      "Method 'update' not supported by LangchainVectorStore wrapper.",
    );
    // Possible implementation: Check if store has delete, call delete({_mem0_id: vectorId}), then insert.
  }

  async delete(vectorId: string): Promise<void> {
    // Check if the underlying store supports deletion by ID
    if (typeof (this.lcStore as any).delete === "function") {
      try {
        // We need to delete based on our stored _mem0_id.
        // 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] });

View on GitHub (pinned to 001c235229)

Solutions

  1. Perform update manually: await store.delete(id) then store.insert([vector], [id], [payload]).
  2. Wrap the adapter in a subclass implementing update as delete+insert if you control the store wiring.
  3. If transparent updates are required, choose a vector store provider with native update support (qdrant, chroma, elasticsearch).

Example fix

// before
await store.update(vectorId, vector, payload); // throws

// after
await store.delete(vectorId);
await store.insert([vector], [vectorId], [payload]);
Defensive patterns

Strategy: fallback

Try / catch

try {
  await store.update(vectorId, vector, payload);
} catch (e) {
  if (e instanceof Error && e.message.includes("Method 'update' not supported")) {
    await store.delete(vectorId);
    await store.insert([vector], [vectorId], [payload]);
    return;
  }
  throw e;
}

Prevention

When it happens

Trigger: Any Memory flow that ends in VectorStore.update(vectorId, vector, payload) — e.g. memory updates after LLM extraction — while using the langchain provider.

Common situations: Running Memory.add() with updates to existing memories over a langchain-backed store; migrating an app from another provider where update worked.

Related errors


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