{"record":{"id":"7bbd8bb80419153d","repo":"mastra-ai/mastra","slug":"working-memory-is-not-enabled-for-this-memory-inst","errorCode":null,"errorMessage":"Working memory is not enabled for this memory instance","messagePattern":"Working memory is not enabled for this memory instance","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/memory/src/index.ts","lineNumber":1000,"sourceCode":"  }\n\n  async updateWorkingMemory({\n    threadId,\n    resourceId,\n    workingMemory,\n    memoryConfig,\n    observabilityContext,\n  }: {\n    threadId: string;\n    resourceId?: string;\n    workingMemory: string;\n    memoryConfig?: MemoryConfigInternal;\n    observabilityContext?: Partial<ObservabilityContext>;\n  }): Promise<void> {\n    const config = this.getMergedThreadConfig(memoryConfig || {});\n\n    if (!config.workingMemory?.enabled) {\n      throw new Error('Working memory is not enabled for this memory instance');\n    }\n\n    const span = this.createMemorySpan(\n      'update',\n      observabilityContext,\n      { threadId, resourceId },\n      {\n        workingMemoryEnabled: true,\n      },\n    );\n\n    try {\n      const scope = config.workingMemory.scope || 'resource';\n\n      // Guard: If resource-scoped working memory is enabled but no resourceId is provided, throw an error\n      if (scope === 'resource' && !resourceId) {\n        throw new Error(\n          `Memory error: Resource-scoped working memory is enabled but no resourceId was provided. ` +","sourceCodeStart":982,"sourceCodeEnd":1018,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/memory/src/index.ts#L982-L1018","documentation":"updateWorkingMemory requires working memory to be enabled in the memory instance's configuration. The merged thread config is checked for workingMemory.enabled and the error is thrown immediately if disabled. It is a configuration precondition, not a data problem.","triggerScenarios":"Calling memory.updateWorkingMemory({ threadId, resourceId, workingMemory }) when no workingMemory config (or workingMemory: { enabled: false }) was set on the Memory instance or via the per-thread config.","commonSituations":"Adding the update-working-memory tool to an agent without enabling workingMemory in the Memory config; per-thread config overriding enabled to false; copying configs between projects.","solutions":["Enable working memory: new Memory({ ..., options: { workingMemory: { enabled: true } } })","Enable it per-call by passing memoryConfig with workingMemory: { enabled: true } in thread options","Remove the update-working-memory tool/agent step if working memory is not used"],"exampleFix":"// before\nconst memory = new Memory({ storage: store, embedder });\n// after\nconst memory = new Memory({ storage: store, embedder, options: { workingMemory: { enabled: true, template: '...' } } });","handlingStrategy":"validation","validationCode":"const cfg = getMergedThreadConfig(memoryConfig);\nif (!cfg.workingMemory?.enabled) throw new Error('Enable workingMemory in Memory options before calling updateWorkingMemory');","typeGuard":null,"tryCatchPattern":"try {\n  await memory.updateWorkingMemory(args);\n} catch (e) {\n  if (e instanceof Error && e.message === 'Working memory is not enabled for this memory instance') {\n    // reconfigure Memory or skip the tool call\n  } else throw e;\n}","preventionTips":["Register the update-working-memory tool only when workingMemory.enabled is true","Keep workingMemory config in one shared Memory factory","Test the tool flow after any Memory config change"],"tags":["memory","working-memory","configuration"],"backgroundTag":"feature-not-enabled","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}