{"record":{"id":"b95c70547812b8b9","repo":"mem0ai/mem0","slug":"update-failed-for-document-vectorid-result-e","errorCode":null,"errorMessage":"Update failed for document ${vectorId}: ${result.errorMessage}","messagePattern":"Update failed for document (.+?): (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"mem0-ts/src/oss/src/vector_stores/azure_ai_search.ts","lineNumber":500,"sourceCode":"      document.vector = vector;\n    }\n\n    if (payload) {\n      document.payload = JSON.stringify(payload);\n\n      // Extract additional fields\n      for (const field of [\"user_id\", \"run_id\", \"agent_id\"]) {\n        if (field in payload) {\n          document[field] = payload[field];\n        }\n      }\n    }\n\n    const response = await this.searchClient.mergeOrUploadDocuments([document]);\n\n    for (const result of response.results) {\n      if (!result.succeeded) {\n        throw new Error(\n          `Update failed for document ${vectorId}: ${result.errorMessage}`,\n        );\n      }\n    }\n  }\n\n  /**\n   * Retrieve a vector by ID\n   */\n  async get(vectorId: string): Promise<VectorStoreResult | null> {\n    await this.initialize();\n    try {\n      const result = await this.searchClient.getDocument(vectorId);\n      const payloadStr = result.payload as string;\n      const payload = JSON.parse(this.extractJson(payloadStr));\n\n      return {\n        id: result.id as string,","sourceCodeStart":482,"sourceCodeEnd":518,"githubUrl":"https://github.com/mem0ai/mem0/blob/001c235229be8795e3834520467bd0d661ed8f34/mem0-ts/src/oss/src/vector_stores/azure_ai_search.ts#L482-L518","documentation":"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.","triggerScenarios":"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.","commonSituations":"Changing embedding providers between add and update; adding new payload keys not present in the index schema; concurrent index rebuilds during update.","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."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { await memory.update(id, text) }\ncatch (e) {\n  if (e instanceof Error && /Update failed for document/.test(e.message)) {\n    // check errorMessage text: dimension -> fix config; unknown field -> adjust payload; transient -> retry\n  }\n  throw e;\n}","preventionTips":["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."],"tags":["azure","vector-store","update","partial-failure"],"backgroundTag":null,"analyzedSha":"001c235229be8795e3834520467bd0d661ed8f34","analyzedAt":"2026-08-15T01:55:42.685Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}