{"record":{"id":"691bb1e101b629da","repo":"mastra-ai/mastra","slug":"working-memory-missing-storage-adapter","errorCode":"WORKING_MEMORY_MISSING_STORAGE_ADAPTER","errorMessage":"Using Mastra Memory working memory requires a storage adapter but no attached adapter was detected.","messagePattern":"Using Mastra Memory working memory requires a storage adapter but no attached adapter was detected\\.","errorType":"error_code","errorClass":"MastraError","httpStatus":null,"severity":"critical","filePath":"packages/core/src/memory/memory.ts","lineNumber":753,"sourceCode":"    // Extract runtime memoryConfig from context if available\n    const memoryContext = context?.get('MastraMemory') as MemoryRequestContext | undefined;\n    const runtimeMemoryConfig = memoryContext?.memoryConfig;\n    const effectiveConfig = runtimeMemoryConfig ? this.getMergedThreadConfig(runtimeMemoryConfig) : this.threadConfig;\n\n    // Add working memory input processor if configured\n    const isWorkingMemoryEnabled =\n      typeof effectiveConfig.workingMemory === 'object' && effectiveConfig.workingMemory.enabled !== false;\n\n    // When useStateSignals is opted in, the WorkingMemoryStateProcessor delivers\n    // working memory via the state-signal lane. Skip the legacy system-message\n    // injection so the model doesn't receive the WORKING_MEMORY_SYSTEM_INSTRUCTION\n    // block alongside the signal.\n    const useStateSignals =\n      typeof effectiveConfig.workingMemory === 'object' && effectiveConfig.workingMemory.useStateSignals === true;\n\n    if (isWorkingMemoryEnabled && !useStateSignals) {\n      if (!memoryStore)\n        throw new MastraError({\n          category: 'USER',\n          domain: ErrorDomain.STORAGE,\n          id: 'WORKING_MEMORY_MISSING_STORAGE_ADAPTER',\n          text: 'Using Mastra Memory working memory requires a storage adapter but no attached adapter was detected.',\n        });\n\n      // Check if user already manually added WorkingMemory\n      const hasWorkingMemory = configuredProcessors.some(p => !isProcessorWorkflow(p) && p.id === 'working-memory');\n\n      if (!hasWorkingMemory) {\n        // Convert string template to WorkingMemoryTemplate format\n        let template: { format: 'markdown' | 'json'; content: string } | undefined;\n        if (typeof effectiveConfig.workingMemory === 'object' && effectiveConfig.workingMemory.template) {\n          template = {\n            format: 'markdown',\n            content: effectiveConfig.workingMemory.template,\n          };\n        }","sourceCodeStart":735,"sourceCodeEnd":771,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/core/src/memory/memory.ts#L735-L771","documentation":"When working memory is enabled (and not using state signals), the input processor pipeline needs a storage adapter to read/write working-memory blocks. getInputProcessors throws this MastraError (WORKING_MEMORY_MISSING_STORAGE_ADAPTER, category USER, domain STORAGE) when memoryStore is absent at processor-build time.","triggerScenarios":"Configuring workingMemory in Memory options and sending an input through an agent's input processors while the Memory instance has no storage adapter attached (nor inherited).","commonSituations":"Standalone Memory with workingMemory enabled but no storage; Mastra instance without storage while Memory relies on inheritance; tests constructing Memory with only options.","solutions":["Attach a storage adapter: storage: new LibSQLStore({ url: 'file:memory.db' }) in the Memory config.","Or configure storage on the Mastra instance so Memory inherits it.","If working memory content should flow via state signals instead, set workingMemory.useStateSignals: true."],"exampleFix":"// before\nconst memory = new Memory({ options: { workingMemory: { template: 'Facts: {{facts}}' } } });\n\n// after\nconst memory = new Memory({\n  storage: new LibSQLStore({ url: 'file:memory.db' }),\n  options: { workingMemory: { template: 'Facts: {{facts}}' } },\n});","handlingStrategy":"validation","validationCode":"function assertWorkingMemoryStorage(memoryConfig) {\n  const wmEnabled = !!memoryConfig?.options?.workingMemory;\n  if (wmEnabled && !memoryConfig?.storage) {\n    throw new Error('workingMemory requires a storage adapter on Memory (or inherited from Mastra)');\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pair every workingMemory option with a storage adapter in the same config.","Or switch to workingMemory.useStateSignals: true when storage is not desired.","Smoke-test agent turns locally where input processors run."],"tags":["memory","working-memory","storage","configuration"],"backgroundTag":"missing-storage-adapter","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}