mem0ai/mem0 · error

Memory with ID ${memoryId} does not have text content to upd

Error message

Memory with ID ${memoryId} does not have text content to update

What it means

Internal guard in updateMemory(): the stored payload's data field is not a string, so there is no text to re-index. This fires on metadata/expiration-only updates (data === undefined) where the code falls back to the stored value but finds a non-string (e.g. an image-only or multimodal memory with no textual data).

Source

Thrown at mem0-ts/src/oss/src/memory/index.ts:1966

    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");

    const sanitizedMetadata = stripIdentityKeys(metadata);

    const newMetadata = {
      ...existingMemory.payload,
      ...sanitizedMetadata,
      data: newData,

View on GitHub (pinned to 001c235229)

Solutions

  1. Pass explicit text in the update so the fallback is not needed: memory.update(id, { text: 'replacement', metadata: {...} })
  2. Avoid metadata-only updates on memories created from image-only content
  3. If the store was seeded externally, ensure documents carry a string payload.data field

Example fix

// before
await memory.update(id, { metadata: { pinned: true } }); // stored memory has no text

// after
await memory.update(id, { text: 'User prefers window seats', metadata: { pinned: true } });
Defensive patterns

Strategy: validation

Validate before calling

const mem = await memory.get(memoryId);
if (typeof mem?.data !== 'string' && !updateText) {
  throw new Error('this memory has no text; supply text explicitly');
}

Type guard

const hasTextPayload = (m: { data?: unknown } | null): m is { data: string } =>
  m !== null && typeof m.data === 'string';

Try / catch

try { await memory.update(id, { metadata }); } catch (e) { if (e instanceof Error && e.message.includes('text content to update')) { await memory.update(id, { text: fallbackText, metadata }); return; } throw e; }

Prevention

When it happens

Trigger: memory.update(id, { metadata: {...} }) or { expirationDate } where the stored memory's payload.data is missing or not a string — typically a memory created from multimodal input where only an image part was retained.

Common situations: Using vision/multimodal messages in add() so the stored memory has no text payload; later attempting a metadata-only update on such a memory; corrupted or manually seeded vector store documents lacking the data field.

Related errors


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