{"record":{"id":"2b8559afc4b97ea1","repo":"mem0ai/mem0","slug":"memory-with-id-memoryid-does-not-have-text-cont","errorCode":null,"errorMessage":"Memory with ID ${memoryId} does not have text content to update","messagePattern":"Memory with ID (.+?) does not have text content to update","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"mem0-ts/src/oss/src/memory/index.ts","lineNumber":1966,"sourceCode":"    return memoryId;\n  }\n\n  private async updateMemory(\n    memoryId: string,\n    data: string | undefined,\n    existingEmbeddings: Record<string, number[]>,\n    metadata: Record<string, any> = {},\n  ): Promise<string> {\n    const existingMemory = await this.vectorStore.get(memoryId);\n    if (!existingMemory) {\n      throw new Error(`Memory with ID ${memoryId} not found`);\n    }\n\n    const prevValue = existingMemory.payload.data;\n    // Metadata-only update: fall back to the stored text so we can re-index it.\n    const newData = data ?? prevValue;\n    if (typeof newData !== \"string\") {\n      throw new Error(\n        `Memory with ID ${memoryId} does not have text content to update`,\n      );\n    }\n    const textChanged = newData !== prevValue;\n\n    const embedding = Object.prototype.hasOwnProperty.call(\n      existingEmbeddings,\n      newData,\n    )\n      ? existingEmbeddings[newData]\n      : await this.embedder.embed(newData, \"update\");\n\n    const sanitizedMetadata = stripIdentityKeys(metadata);\n\n    const newMetadata = {\n      ...existingMemory.payload,\n      ...sanitizedMetadata,\n      data: newData,","sourceCodeStart":1948,"sourceCodeEnd":1984,"githubUrl":"https://github.com/mem0ai/mem0/blob/001c235229be8795e3834520467bd0d661ed8f34/mem0-ts/src/oss/src/memory/index.ts#L1948-L1984","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","solutions":["Pass explicit text in the update so the fallback is not needed: memory.update(id, { text: 'replacement', metadata: {...} })","Avoid metadata-only updates on memories created from image-only content","If the store was seeded externally, ensure documents carry a string payload.data field"],"exampleFix":"// before\nawait memory.update(id, { metadata: { pinned: true } }); // stored memory has no text\n\n// after\nawait memory.update(id, { text: 'User prefers window seats', metadata: { pinned: true } });","handlingStrategy":"validation","validationCode":"const mem = await memory.get(memoryId);\nif (typeof mem?.data !== 'string' && !updateText) {\n  throw new Error('this memory has no text; supply text explicitly');\n}","typeGuard":"const hasTextPayload = (m: { data?: unknown } | null): m is { data: string } =>\n  m !== null && typeof m.data === 'string';","tryCatchPattern":"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; }","preventionTips":["Always pass text when updating memories that may originate from image-only input","Check memory.get() results for a string data field before metadata-only updates"],"tags":["oss","memory-update","multimodal","internal"],"backgroundTag":null,"analyzedSha":"001c235229be8795e3834520467bd0d661ed8f34","analyzedAt":"2026-08-15T01:55:42.685Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}