{"record":{"id":"e899a6c1ee031a0a","repo":"mastra-ai/mastra","slug":"no-observational-memory-record-found-for-thread","errorCode":null,"errorMessage":"No observational memory record found for thread ${ids.threadId}","messagePattern":"No observational memory record found for thread (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/memory/src/processors/observational-memory/observational-memory.ts","lineNumber":4018,"sourceCode":"   * to the instance-level config.\n   *\n   * @example\n   * ```ts\n   * await om.updateRecordConfig('thread-1', undefined, {\n   *   observation: { messageTokens: 2000 },\n   *   reflection: { observationTokens: 8000 },\n   * });\n   * ```\n   */\n  async updateRecordConfig(\n    threadId: string,\n    resourceId: string | undefined,\n    config: Record<string, unknown>,\n  ): Promise<void> {\n    const ids = this.getStorageIds(threadId, resourceId);\n    const record = await this.storage.getObservationalMemory(ids.threadId, ids.resourceId);\n    if (!record) {\n      throw new Error(`No observational memory record found for thread ${ids.threadId}`);\n    }\n    // Write under _overrides so getEffectiveMessageTokens / getEffectiveReflectionTokens\n    // pick up the override values, distinct from the initial config snapshot.\n    await this.storage.updateObservationalMemoryConfig({\n      id: record.id,\n      config: { _overrides: config },\n    });\n  }\n\n  /**\n   * Get observation history (previous generations)\n   */\n  async getHistory(\n    threadId: string,\n    resourceId?: string,\n    limit?: number,\n    options?: ObservationalMemoryHistoryOptions,\n  ): Promise<ObservationalMemoryRecord[]> {","sourceCodeStart":4000,"sourceCodeEnd":4036,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/memory/src/processors/observational-memory/observational-memory.ts#L4000-L4036","documentation":"This error comes from the ObservationalMemory config-override path: it loads the existing observational memory record via `storage.getObservationalMemory(threadId, resourceId)` before writing `_overrides` config onto it. If no record exists for that thread (the thread was never processed by ObservationalMemory, or the ids are wrong), there is nothing to update, so it throws `No observational memory record found for thread <id>`.","triggerScenarios":"Calling the config-update/updateObservationalMemoryConfig path (e.g. `memory.updateObservationalMemoryConfig(...)` or equivalent API) with a threadId that has no stored OM record — typically a brand-new thread or a typo'd id (observational-memory.ts:4018).","commonSituations":"Updating OM config for a thread created but never used with the agent; pointing at a different storage backend than the one that holds the record; resourceId mismatch so the composite lookup misses; race where the update call lands before the first OM processing run created the record.","solutions":["Run the thread through the agent/ObservationalMemory at least once so the record is created, then apply the config override.","Verify the threadId (and resourceId) match the ones used when the record was created.","Confirm you are reading/writing the same storage backend where the OM record lives.","Add a pre-check via getObservationalMemory(threadId, resourceId) and handle the missing-record case gracefully instead of updating blindly."],"exampleFix":"// before\nawait memory.updateObservationalMemoryConfig(threadId, resourceId, config); // throws if record missing\n// after\nconst record = await memory.getObservationalMemory(threadId, resourceId);\nif (record) {\n  await memory.updateObservationalMemoryConfig(threadId, resourceId, config);\n}","handlingStrategy":"try-catch","validationCode":"const record = await storage.getObservationalMemory(threadId, resourceId);\nif (!record) {\n  throw new Error(`Cannot update OM config: no record for thread ${threadId}. Run the thread through the agent first.`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await memory.updateObservationalMemoryConfig(threadId, resourceId, config);\n} catch (e) {\n  if (e instanceof Error && e.message.startsWith('No observational memory record found for thread')) {\n    // record not created yet: initialize by running the thread once, or skip\n    return; // or bootstrap the record\n  }\n  throw e;\n}","preventionTips":["Only update OM config for threads that have completed at least one OM processing run.","Pre-check getObservationalMemory(threadId, resourceId) before updating.","Double-check threadId/resourceId values against stored records (avoid typos and cross-environment ids).","Ensure all services point at the same storage backend instance."],"tags":["observational-memory","not-found","storage"],"backgroundTag":"record-not-found","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}