{"record":{"id":"4d60a08fb5dddb46","repo":"mem0ai/mem0","slug":"the-decay-parameter-is-not-supported-by-the-oss-me","errorCode":null,"errorMessage":"The decay parameter is not supported by the OSS Memory SDK.","messagePattern":"The decay parameter is not supported by the OSS Memory SDK\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"mem0-ts/src/oss/src/memory/index.ts","lineNumber":714,"sourceCode":"      this.telemetryId = \"anonymous\";\n      return this.telemetryId;\n    }\n  }\n\n  static fromConfig(configDict: Record<string, any>): Memory {\n    try {\n      const config = MemoryConfigSchema.parse(configDict);\n      return new Memory(config);\n    } catch (e) {\n      console.error(\"Configuration validation error:\", e);\n      throw e;\n    }\n  }\n\n  async updateProject(options: UpdateProjectOptions = {}): Promise<never> {\n    if (options?.decay === true) {\n      await this._getNoticeTelemetryId();\n      throw new Error(await getDecayFeatureErrorMessage(this));\n    }\n\n    throw new Error(\"Project updates are not supported by the OSS Memory SDK.\");\n  }\n\n  async add(\n    messages: string | Message[],\n    config: AddMemoryOptions,\n  ): Promise<SearchResult> {\n    if (config?.timestamp !== undefined) {\n      await this._getNoticeTelemetryId();\n      throw new Error(\n        await getTemporalFeatureErrorMessage(this, {\n          triggerFunction: \"add\",\n          triggerParameter: \"timestamp\",\n        }),\n      );\n    }","sourceCodeStart":696,"sourceCodeEnd":732,"githubUrl":"https://github.com/mem0ai/mem0/blob/001c235229be8795e3834520467bd0d661ed8f34/mem0-ts/src/oss/src/memory/index.ts#L696-L732","documentation":"updateProject(options) in the OSS TypeScript SDK always throws because project-level updates are a hosted-platform feature; when options.decay === true it additionally fetches a telemetry/notice id and throws a decay-specific feature message explaining that decay is platform-only. The type is Promise<never>, signaling the method intentionally never succeeds.","triggerScenarios":"Calling memory.updateProject({ decay: true }) (or any truthy decay) on an OSS Memory instance — code ported from the hosted MemoryClient API where updateProject({ decay: true }) is valid.","commonSituations":"Sharing code between the hosted client (mem0ai MemoryClient) and the OSS SDK (mem0ai/oss Memory) and calling the platform method on the wrong instance; following platform docs while self-hosting; trying to apply memory decay/aging to a self-hosted deployment.","solutions":["Use the hosted MemoryClient with a MEM0_API_KEY if you need project updates/decay.","Remove the updateProject({ decay: true }) call from OSS code paths; decay is not available self-hosted.","Branch by client type if code is shared: only call updateProject on MemoryClient instances.","For self-hosted decay-like behavior, implement your own recency weighting when ranking retrieved memories."],"exampleFix":"// before (OSS Memory)\nawait memory.updateProject({ decay: true }); // throws: decay not supported\n\n// after\nimport { MemoryClient } from 'mem0ai';\nconst client = new MemoryClient({ apiKey: process.env.MEM0_API_KEY });\nawait client.updateProject({ projectId, decay: true }); // supported on hosted platform","handlingStrategy":"type-guard","validationCode":"function assertPlatformClient(client: unknown, method: string): void {\n  if (!(client instanceof MemoryClient)) {\n    throw new TypeError(`${method}() is hosted-platform only; use MemoryClient, not OSS Memory`);\n  }\n}","typeGuard":"function supportsProjectUpdates(client: Memory | MemoryClient): client is MemoryClient {\n  return 'projectId' in (client as MemoryClient) || client instanceof MemoryClient;\n}","tryCatchPattern":"try {\n  await memory.updateProject({ decay: true });\n} catch (err) {\n  if (err instanceof Error && /decay .*not supported/i.test(err.message)) {\n    // feature gate: skip decay in OSS mode, or route to hosted client\n    return;\n  }\n  throw err;\n}","preventionTips":["Keep hosted-client code and OSS code in separate modules so platform-only calls can't leak.","Gate platform features behind a capability flag in shared abstractions.","Read the OSS SDK's Promise<never> signatures as documentation: never call these methods."],"tags":["oss-sdk","platform-feature","decay","unsupported","typescript"],"backgroundTag":null,"analyzedSha":"001c235229be8795e3834520467bd0d661ed8f34","analyzedAt":"2026-08-15T01:55:42.685Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}