mem0ai/mem0 · error
Memory with ID ${memoryId} not found
Error message
Memory with ID ${memoryId} not found What it means
Internal guard in the private updateMemory(): the memory ID is not present in the vector store (vectorStore.get(id) returned null) before attempting an update. It usually surfaces through the public update()/add() reconciliation flow when a stale or already-deleted memory ID is referenced, e.g. in linked_memory_ids or an inferred-update path.
Source
Thrown at mem0-ts/src/oss/src/memory/index.ts:1959
memoryId,
null,
data,
"ADD",
memoryMetadata.createdAt,
);
return memoryId;
}
private async updateMemory(
memoryId: string,
data: string | undefined,
existingEmbeddings: Record<string, number[]>,
metadata: Record<string, any> = {},
): Promise<string> {
const existingMemory = await this.vectorStore.get(memoryId);
if (!existingMemory) {
throw new Error(`Memory with ID ${memoryId} not found`);
}
const prevValue = existingMemory.payload.data;
// Metadata-only update: fall back to the stored text so we can re-index it.
const newData = data ?? prevValue;
if (typeof newData !== "string") {
throw new Error(
`Memory with ID ${memoryId} does not have text content to update`,
);
}
const textChanged = newData !== prevValue;
const embedding = Object.prototype.hasOwnProperty.call(
existingEmbeddings,
newData,
)
? existingEmbeddings[newData]
: await this.embedder.embed(newData, "update");View on GitHub (pinned to 001c235229)
Solutions
- Verify the ID exists first with memory.get(memoryId) and skip gracefully if null
- If IDs are persisted long-term, re-fetch them per session instead of caching
- In multi-writer setups, coordinate resets so no client holds stale IDs
Example fix
// before
await memory.update(staleId, { text: 'updated' });
// after
const mem = await memory.get(staleId);
if (mem) {
await memory.update(staleId, { text: 'updated' });
} Defensive patterns
Strategy: try-catch
Validate before calling
const existing = await memory.get(memoryId);
if (!existing) {
// stale reference — refresh your memory list and skip
} Try / catch
try { await memory.update(id, { text }); } catch (e) { if (e instanceof Error && e.message.includes('not found')) { await refreshMemoryList(); return; } throw e; } Prevention
- Do not cache memory IDs across store resets or long sessions — re-fetch before mutating
- In multi-instance deployments, coordinate who may call reset() while others hold references
When it happens
Trigger: updateMemory(memoryId) is called with an ID that does not exist in the vector store — deleted by another process, expired and cleaned up, from a different environment, or a typo'd/hallucinated ID (LLM extraction can emit IDs that no longer resolve).
Common situations: Holding a memory ID across a long session while another client deletes or resets the store; multi-instance deployments where one instance resets the vector DB; LLM extraction returning linked IDs from a previous conversation state.
Related errors
- Memory with ID ${memoryId} does not have text content to upd
- At least one of text, metadata, or expirationDate must be pr
- messages array cannot contain only blank content. Provide at
- messages string cannot be empty. Provide non-empty content.
- One of the filters: userId, agentId or runId is required!
AI-assisted analysis of mem0ai/mem0@001c235229 (2026-08-15).
Data as JSON: /api/errors/9a6847564d0ea1b1.
Report an issue: GitHub.