{"record":{"id":"674800e7aa5856a9","repo":"mem0ai/mem0","slug":"method-deletecol-not-supported-by-langchainvecto","errorCode":null,"errorMessage":"Method 'deleteCol' not supported by LangchainVectorStore wrapper.","messagePattern":"Method 'deleteCol' not supported by LangchainVectorStore wrapper\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"mem0-ts/src/oss/src/vector_stores/langchain.ts","lineNumber":215,"sourceCode":"  async list(\n    filters?: SearchFilters,\n    topK: number = 100,\n  ): Promise<[VectorStoreResult[], number]> {\n    // No standard list method in Langchain core interface.\n    console.error(\n      `LangchainVectorStore: The 'list' method is not supported by the generic LangchainVectorStore wrapper.`,\n    );\n    throw new Error(\n      \"Method 'list' not supported by LangchainVectorStore wrapper.\",\n    );\n    // Could potentially be implemented if the underlying store has a specific list/scroll/query capability.\n  }\n\n  async deleteCol(): Promise<void> {\n    console.error(\n      `LangchainVectorStore: The 'deleteCol' method is not supported by the generic LangchainVectorStore wrapper.`,\n    );\n    throw new Error(\n      \"Method 'deleteCol' not supported by LangchainVectorStore wrapper.\",\n    );\n  }\n\n  // --- Wrapper-Specific Methods (In-Memory User ID) ---\n\n  async getUserId(): Promise<string> {\n    return this.storeUserId;\n  }\n\n  async setUserId(userId: string): Promise<void> {\n    this.storeUserId = userId;\n  }\n\n  async initialize(): Promise<void> {\n    // No specific initialization needed for the wrapper itself,\n    // assuming the passed Langchain client is already initialized.\n    return Promise.resolve();","sourceCodeStart":197,"sourceCodeEnd":233,"githubUrl":"https://github.com/mem0ai/mem0/blob/001c235229be8795e3834520467bd0d661ed8f34/mem0-ts/src/oss/src/vector_stores/langchain.ts#L197-L233","documentation":"The LangchainVectorStore adapter throws this from deleteCol() because the generic LangChain vector store interface has no portable 'delete collection' operation. The wrapper only delegates methods that every underlying LangChain store exposes (addDocuments, similaritySearch, delete by id); destroying the whole collection is backend-specific. Calling deleteCol() therefore always fails by design.","triggerScenarios":"Instantiating Memory with vectorStore: { provider: 'langchain', config: { client: <any LangChain VectorStore> } } and then calling memory.vectorStore.deleteCol(), or running a reset/wipe routine that calls deleteCol() on every configured store. Also hit by generic tooling (CLI, tests) that assumes the full VectorStoreAPI surface.","commonSituations":"Teams using an in-memory or niche LangChain store (e.g. MemoryVectorStore, HNSWLib) as a drop-in Mem0 backend, then trying to reset state between test runs. Migration from a concrete provider (qdrant/chroma) to the langchain wrapper where deleteCol previously worked.","solutions":["Switch to a concrete Mem0 vector store provider (qdrant, chroma, sqlite (memory.ts), etc.) if you need collection lifecycle operations.","Delete documents by id instead: keep the ids you inserted and call the wrapper's delete(ids), which is supported.","Subclass LangchainVectorStore and override deleteCol() to call your specific backend's destroy/drop method (e.g. client.delete({ ids: true }) for Chroma).","For tests, recreate the underlying LangChain store instance instead of calling deleteCol()."],"exampleFix":"// before\nawait memory.vectorStore.deleteCol(); // throws: not supported by wrapper\n\n// after (drop documents by id)\nawait memory.vectorStore.delete inserted ids via store.delete(ids);\n// or subclass:\nclass MyLangchainStore extends LangchainVectorStore {\n  async deleteCol(): Promise<void> {\n    // backend-specific, e.g. for a Chroma-backed client:\n    await (this as any).lc_kwargs.client.delete({ deleteAll: true });\n  }\n}","handlingStrategy":"type-guard","validationCode":"const canDeleteCol = (s: any): boolean => typeof s.deleteCol === 'function' && s.constructor?.name !== 'LangchainVectorStore';","typeGuard":"function supportsDeleteCol(store: unknown): store is { deleteCol(): Promise<void> } {\n  return (\n    !!store &&\n    typeof (store as any).deleteCol === 'function' &&\n    !(store instanceof (require('./langchain').LangchainVectorStore))\n  );\n}","tryCatchPattern":"try {\n  await store.deleteCol();\n} catch (e) {\n  if (e instanceof Error && /not supported by LangchainVectorStore wrapper/.test(e.message)) {\n    // fall back to deleting by ids or recreating the underlying store\n  } else throw e;\n}","preventionTips":["Check provider capabilities before wiring generic reset tooling: only concrete stores implement deleteCol.","Track inserted ids so you can delete documents individually on the langchain wrapper.","In test suites, recreate the Memory instance with a fresh underlying LangChain store instead of calling deleteCol."],"tags":["langchain","vector-store","unsupported-operation","typescript"],"backgroundTag":null,"analyzedSha":"001c235229be8795e3834520467bd0d661ed8f34","analyzedAt":"2026-08-15T01:55:42.685Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}