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

  1. Match errorMessage to the cause: dimension mismatch -> realign embeddingModelDims and index; unknown field -> extend index schema or drop the payload key.
  2. Recreate the index if the vector configuration changed, then re-add memories.
  3. 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

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


AI-assisted analysis of mem0ai/mem0@001c235229 (2026-08-15). Data as JSON: /api/errors/b95c70547812b8b9. Report an issue: GitHub.