mem0ai/mem0 · error · Error
memory_id is required for update
Error message
memory_id is required for update
What it means
Validation error thrown by the pi-agent-plugin memory tool's 'update' action when params.memory_id is missing. The tool requires both an id (which memory to edit) and content (the new text) before calling mem0.update(memory_id, { text }). This is a tool-invocation contract violation, typically from an LLM omitting a required parameter.
Source
Thrown at integrations/pi-agent-plugin/src/memory/tools.ts:97
content: [{ type: "text" as const, text: msg }],
details: { eventId: res.eventId ?? null, status: res.status ?? null },
};
}
case "get_all": {
if (signal?.aborted) throw new Error("Cancelled");
const filters = resolveSearchFilters(scope, scopeCtx);
const result = await mem0.getAll({ filters });
const memories = result.results ?? [];
return {
content: [{ type: "text" as const, text: truncateOutput(formatMemoryList(memories)) }],
details: { totalCount: result.count ?? memories.length },
};
}
case "update": {
if (signal?.aborted) throw new Error("Cancelled");
if (!params.memory_id) throw new Error("memory_id is required for update");
if (!params.content) throw new Error("content is required for update");
const updateResult = await mem0.update(params.memory_id, { text: params.content });
const res = updateResult as MemoryResult;
return {
content: [{ type: "text" as const, text: res.status ?? "Memory updated." }],
details: { memoryId: params.memory_id },
};
}
case "delete": {
if (signal?.aborted) throw new Error("Cancelled");
if (!params.memory_id) throw new Error("memory_id is required for delete");
const result = await mem0.delete(params.memory_id);
return {
content: [{ type: "text" as const, text: result.message ?? "Memory deleted." }],
details: {},
};
}View on GitHub (pinned to 001c235229)
Solutions
- In the agent flow, always search or get_all first and feed a real memory id into the update call.
- Check the parameter name: it must be memory_id, not id or memoryId.
- Improve the tool description/prompt so the model knows memory_id is required for update.
Example fix
// before (agent tool params)
{ "action": "update", "content": "new text" } // no memory_id
// after
{ "action": "update", "memory_id": "m-abc123", "content": "new text" } Defensive patterns
Strategy: validation
Validate before calling
if (params.action === 'update') {
if (!params.memory_id || !params.content) {
return { content: [{ type: 'text', text: 'update requires memory_id and content; run search first to get an id' }] };
}
} Type guard
function isValidUpdateParams(p: ToolParams): p is ToolParams & { memory_id: string; content: string } {
return typeof p.memory_id === 'string' && p.memory_id.length > 0 && typeof p.content === 'string';
} Prevention
- Tool description should state memory_id is required and comes from search/get_all.
- Always search before update in agent prompts; never let the model invent ids.
- Use the exact key memory_id (not id/memoryId).
When it happens
Trigger: The agent (LLM) calls the memory tool with action='update' but no memory_id in params — e.g. it invented an update without first retrieving an id from search/get_all, or passed the id under a wrong key (id instead of memory_id).
Common situations: LLM tool-calling hallucination: updating 'the memory about X' without looking up its id first; schema drift between the tool's declared parameters and what the model emits.
Related errors
- Unknown LLM provider: ${providerId}
- Azure OpenAI requires both API key and endpoint
- Langchain provider requires an initialized Langchain instanc
- Either memoryId or --all is required
- At least one entity ID is required for deleteEntities.
AI-assisted analysis of mem0ai/mem0@001c235229 (2026-08-15).
Data as JSON: /api/errors/157061dee630dbfb.
Report an issue: GitHub.