{"record":{"id":"f7ee7fb61112c936","repo":"mem0ai/mem0","slug":"at-least-one-of-text-metadata-timestamp-or-expi","errorCode":null,"errorMessage":"At least one of text, metadata, timestamp, or expirationDate must be provided for update.","messagePattern":"At least one of text, metadata, timestamp, or expirationDate must be provided for update\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"mem0-ts/src/client/mem0.ts","lineNumber":360,"sourceCode":"    {\n      text,\n      metadata,\n      timestamp,\n      expirationDate,\n    }: {\n      text?: string;\n      metadata?: Record<string, any>;\n      timestamp?: number | string;\n      expirationDate?: string | null;\n    },\n  ): Promise<Array<Memory>> {\n    if (\n      text === undefined &&\n      metadata === undefined &&\n      timestamp === undefined &&\n      expirationDate === undefined\n    ) {\n      throw new Error(\n        \"At least one of text, metadata, timestamp, or expirationDate must be provided for update.\",\n      );\n    }\n\n    const payload: Record<string, any> = {};\n    if (text !== undefined) payload.text = text;\n    if (metadata !== undefined) payload.metadata = metadata;\n    if (timestamp !== undefined) payload.timestamp = timestamp;\n    if (expirationDate !== undefined) payload.expiration_date = expirationDate;\n\n    const payloadKeys = Object.keys(payload);\n    this._captureEvent(\"update\", [payloadKeys]);\n\n    const response = await this._fetchWithErrorHandling(\n      `${this.host}/v1/memories/${encodePathSegment(memoryId)}/`,\n      {\n        method: \"PUT\",\n        headers: this.headers,","sourceCodeStart":342,"sourceCodeEnd":378,"githubUrl":"https://github.com/mem0ai/mem0/blob/001c235229be8795e3834520467bd0d661ed8f34/mem0-ts/src/client/mem0.ts#L342-L378","documentation":"MemoryClient.update() requires at least one mutable field — text, metadata, timestamp, or expirationDate — and throws if all four are undefined. A memory update with no changes would be a no-op PATCH, so the client rejects it up front with an explicit message naming the accepted fields.","triggerScenarios":"await client.update(memoryId, {}) — building the update object dynamically and every property ending up undefined (typos like `textt`, conditionals that skip all assignments, or spreading an empty source object).","commonSituations":"Forms where no field was edited but save was clicked; partial-update builders using conditional spreads that collapse to nothing; property-name mismatches (expiryDate vs expirationDate) leaving the payload empty.","solutions":["Ensure at least one field is set: client.update(id, { text: newText }).","Guard dynamically built payloads: if (!Object.values(patch).some(v => v !== undefined)) return.","Check field spelling — expirationDate (camelCase) maps to expiration_date in the payload; typo'd keys are silently undefined."],"exampleFix":"// before\nawait client.update(memoryId, {}); // nothing to update\n\n// after\nawait client.update(memoryId, { text: 'updated content' });","handlingStrategy":"validation","validationCode":"type UpdateFields = { text?: string; metadata?: Record<string, unknown>; timestamp?: number | string; expirationDate?: string | null };\n\nfunction hasAnyUpdateField(p: UpdateFields): boolean {\n  return p.text !== undefined || p.metadata !== undefined ||\n         p.timestamp !== undefined || p.expirationDate !== undefined;\n}\n\nif (!hasAnyUpdateField(patch)) return; // nothing to do — skip the call","typeGuard":"const isUpdatePatch = (p: unknown): p is { text: string } | { metadata: Record<string, unknown> } | { timestamp: number | string } | { expirationDate: string | null } =>\n  typeof p === 'object' && p !== null &&\n  ['text', 'metadata', 'timestamp', 'expirationDate'].some(k => (p as Record<string, unknown>)[k] !== undefined);","tryCatchPattern":null,"preventionTips":["Skip update() when a form or diff produced no changes.","Type update payloads explicitly so typo'd keys fail typecheck.","Remember the field is expirationDate (not expiryDate) on the client."],"tags":["validation","update","empty-input"],"backgroundTag":null,"analyzedSha":"001c235229be8795e3834520467bd0d661ed8f34","analyzedAt":"2026-08-15T01:55:42.685Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}