{"record":{"id":"bacf1c8ce930572c","repo":"mastra-ai/mastra","slug":"observational-memory-is-not-enabled","errorCode":null,"errorMessage":"Observational memory is not enabled","messagePattern":"Observational memory is not enabled","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/memory/src/index.ts","lineNumber":2379,"sourceCode":"   *   config: {\n   *     observation: { messageTokens: 2000 },\n   *     reflection: { observationTokens: 8000 },\n   *   },\n   * });\n   * ```\n   */\n  public async updateObservationalMemoryConfig({\n    threadId,\n    resourceId,\n    config,\n  }: {\n    threadId: string;\n    resourceId?: string;\n    config: Record<string, unknown>;\n  }): Promise<void> {\n    const omEngine = await this.omEngine;\n    if (!omEngine) {\n      throw new Error('Observational memory is not enabled');\n    }\n    await omEngine.updateRecordConfig(threadId, resourceId, config);\n  }\n\n  /**\n   * Summarize one of this memory's threads in one shot.\n   *\n   * Loads the thread's messages from storage and runs `summarizeConversation()` over them —\n   * Observational Memory's Observer plumbing as a standalone call. Nothing is written back to\n   * memory: the summary and extracted values are returned to you (and to each extractor's\n   * `onExtracted` hook), so you decide where they go. Works whether or not observational\n   * memory is enabled on this instance.\n   *\n   * Use this when a session ends and you want a summary or structured extraction of the whole\n   * conversation — for example a voice call at hang-up.\n   *\n   * Messages are loaded page-by-page starting from the newest, bounded by `lastMessages` and\n   * `maxInputTokens`, so summarizing a very long thread doesn't read its entire history from","sourceCodeStart":2361,"sourceCodeEnd":2397,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/memory/src/index.ts#L2361-L2397","documentation":"This is thrown by Memory methods that delegate to the observational-memory engine (e.g. updateRecordConfig). The OM engine is only instantiated when observational memory is enabled in the Memory options; when it is absent, the method cannot run and the library throws.","triggerScenarios":"Calling memory.updateRecordConfig(...) (or similar OM-specific methods) on a Memory instance whose options do not enable observational memory, so `omEngine` resolves to undefined.","commonSituations":"Copy-pasting OM management code into a project whose Memory is configured with plain storage/vector only; toggling OM off via config but keeping the updateRecordConfig calls; assuming OM ships enabled by default.","solutions":["Enable observational memory in the Memory options (e.g. options.enableObservationalMemory = true, or supply the OM configuration object)","Guard the call site: only invoke OM management methods when OM is known to be enabled","Check for a runtime/config flag or env var that conditionally disables OM and reconcile it with the code path"],"exampleFix":"// before\nconst memory = new Memory({ storage, vector, embedder });\nawait memory.updateRecordConfig({ threadId, resourceId, config });\n\n// after\nconst memory = new Memory({ storage, vector, embedder, enableObservationalMemory: true });\nawait memory.updateRecordConfig({ threadId, resourceId, config });","handlingStrategy":"validation","validationCode":"function omEnabled(memory: Memory): boolean {\n  return Boolean((memory as any).omEngine ?? (memory as any).options?.enableObservationalMemory);\n}\nif (!omEnabled(memory)) return; // skip OM-specific management call","typeGuard":null,"tryCatchPattern":"try {\n  await memory.updateRecordConfig({ threadId, resourceId, config });\n} catch (err) {\n  if (err instanceof Error && err.message === 'Observational memory is not enabled') {\n    console.warn('Skipping record config update: OM disabled');\n    return;\n  }\n  throw err;\n}","preventionTips":["Enable observational memory wherever OM-specific methods are used; keep flag and calls in the same module","Gate OM management code paths behind the same feature flag that enables OM","Document in your config layer that OM-dependent calls require OM to be on"],"tags":["memory","observational-memory","feature-flag","configuration"],"backgroundTag":"feature-not-enabled","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}