mem0ai/mem0 · error · Error
Update failed for document ${vectorId}: ${result.errorMessag
Error message
Update failed for document ${vectorId}: ${result.errorMessage} What it means
update() merges or uploads a single document via mergeOrUploadDocuments and throws if the per-document result.succeeded is false, including the vectorId and Azure's errorMessage. This is the update path of the Azure AI Search store, and like insert/delete it must inspect per-document results because Azure returns partial success within a successful HTTP response.
Source
Thrown at mem0-ts/src/oss/src/vector_stores/azure_ai_search.ts:500
document.vector = vector;
}
if (payload) {
document.payload = JSON.stringify(payload);
// Extract additional fields
for (const field of ["user_id", "run_id", "agent_id"]) {
if (field in payload) {
document[field] = payload[field];
}
}
}
const response = await this.searchClient.mergeOrUploadDocuments([document]);
for (const result of response.results) {
if (!result.succeeded) {
throw new Error(
`Update failed for document ${vectorId}: ${result.errorMessage}`,
);
}
}
}
/**
* Retrieve a vector by ID
*/
async get(vectorId: string): Promise<VectorStoreResult | null> {
await this.initialize();
try {
const result = await this.searchClient.getDocument(vectorId);
const payloadStr = result.payload as string;
const payload = JSON.parse(this.extractJson(payloadStr));
return {
id: result.id as string,View on GitHub (pinned to 001c235229)
Solutions
- Match errorMessage to the cause: dimension mismatch -> realign embeddingModelDims and index; unknown field -> extend index schema or drop the payload key.
- Recreate the index if the vector configuration changed, then re-add memories.
- Retry transient failures with backoff.
Defensive patterns
Strategy: try-catch
Try / catch
try { await memory.update(id, text) }
catch (e) {
if (e instanceof Error && /Update failed for document/.test(e.message)) {
// check errorMessage text: dimension -> fix config; unknown field -> adjust payload; transient -> retry
}
throw e;
} Prevention
- Never change the embedding model between add and update on the same index.
- Keep payload keys stable across the memory lifecycle; extend the index schema before adding new fields.
- Log the full per-document errorMessage — it contains the Azure-side reason.
When it happens
Trigger: memory.update() where the new vector dimension differs from the index field; payload fields failing the index's field type (e.g. collection/Edm.String mismatch); index dropped between get and update.
Common situations: Changing embedding providers between add and update; adding new payload keys not present in the index schema; concurrent index rebuilds during update.
Related errors
- Insert failed for document ${result.key}: ${result.errorMess
- Delete failed for document ${vectorId}: ${result.errorMessag
- Update failed for document {vector_id}: {doc}
- Vector dimension mismatch. Expected ${this.dimension}, got $
- Either 'password' must be provided or 'use_azure_credential'
AI-assisted analysis of mem0ai/mem0@001c235229 (2026-08-15).
Data as JSON: /api/errors/b95c70547812b8b9.
Report an issue: GitHub.