{"record":{"id":"d969ad269f067357","repo":"mastra-ai/mastra","slug":"semantic-recall-missing-storage-adapter","errorCode":"SEMANTIC_RECALL_MISSING_STORAGE_ADAPTER","errorMessage":"Using Mastra Memory semantic recall requires a storage adapter but no attached adapter was detected.","messagePattern":"Using Mastra Memory semantic recall requires a storage adapter but no attached adapter was detected\\.","errorType":"error_code","errorClass":"MastraError","httpStatus":null,"severity":"error","filePath":"packages/core/src/memory/memory.ts","lineNumber":820,"sourceCode":"      const hasObservationalMemory =\n        configuredProcessors.some(p => !isProcessorWorkflow(p) && p.id === 'observational-memory') ||\n        isObservationalMemoryEnabled(effectiveConfig.observationalMemory);\n\n      // Skip MessageHistory input processor if ObservationalMemory handles message loading\n      if (!hasMessageHistory && !hasObservationalMemory) {\n        processors.push(\n          new MessageHistory({\n            storage: memoryStore,\n            lastMessages: typeof lastMessages === 'number' ? lastMessages : undefined,\n          }),\n        );\n      }\n    }\n\n    // Add semantic recall input processor if configured\n    if (effectiveConfig.semanticRecall) {\n      if (!memoryStore)\n        throw new MastraError({\n          category: 'USER',\n          domain: ErrorDomain.STORAGE,\n          id: 'SEMANTIC_RECALL_MISSING_STORAGE_ADAPTER',\n          text: 'Using Mastra Memory semantic recall requires a storage adapter but no attached adapter was detected.',\n        });\n\n      if (!this.vector)\n        throw new MastraError({\n          category: 'USER',\n          domain: ErrorDomain.MASTRA_VECTOR,\n          id: 'SEMANTIC_RECALL_MISSING_VECTOR_ADAPTER',\n          text: 'Using Mastra Memory semantic recall requires a vector adapter but no attached adapter was detected.',\n        });\n\n      if (!this.embedder)\n        throw new MastraError({\n          category: 'USER',\n          domain: ErrorDomain.MASTRA_VECTOR,","sourceCodeStart":802,"sourceCodeEnd":838,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/core/src/memory/memory.ts#L802-L838","documentation":"Mastra Memory's semantic recall feature retrieves past messages similar to the current input, which requires persisting messages and embeddings. When building input processors, Mastra checks that a storage adapter is attached to the Memory instance (or Mastra instance). If `effectiveConfig.semanticRecall` is enabled but `memoryStore` is undefined, this MastraError is thrown before any processing begins.","triggerScenarios":"Calling getInputProcessors (directly or via agent.stream/generate) on a Memory instance where `threadConfig.semanticRecall` (or a runtime memoryConfig.semanticRecall) is truthy while no storage adapter was registered via `new Memory({ storage: ... })` or `mastra.attachStorage(...)`.","commonSituations":"Constructing `new Memory({ options: { semanticRecall: { topK: 5 } } })` without a `storage` key; enabling semanticRecall through a per-request `memoryConfig` on a standalone agent that was never attached to a Mastra instance with storage; upgrading Mastra where storage used to be optional for recall.","solutions":["Pass a storage adapter when constructing Memory: `new Memory({ storage: new PgStore({...}), options: { semanticRecall: {...} } })`.","If the agent is standalone, pass storage directly to Memory rather than relying on the Mastra instance; or attach the Memory+storage to `new Mastra({ storage })`.","If semantic recall is not needed, remove/disable `semanticRecall` in the memory config or the runtime `memoryConfig` passed to generate/stream."],"exampleFix":"// before\nconst memory = new Memory({ options: { semanticRecall: { topK: 5 } } });\n// after\nconst memory = new Memory({\n  storage: new LibSQLStore({ url: 'file:./mastra.db' }),\n  options: { semanticRecall: { topK: 5 } },\n});","handlingStrategy":"validation","validationCode":"function assertSemanticRecallReady(memory) {\n  if (memory.threadConfig?.semanticRecall && !memory.hasOwnStorage) {\n    throw new Error('semanticRecall enabled but no storage adapter attached to Memory');\n  }\n}","typeGuard":"function hasStorage(m): m is MastraMemory & { storage: NonNullable<MastraMemory['storage']> } {\n  return Boolean((m as any).storage ?? (m as any).hasOwnStorage);\n}","tryCatchPattern":null,"preventionTips":["Always pass `storage` when enabling semanticRecall in Memory options.","Create a factory/helper that bundles storage+vector+embedder so configs stay consistent.","In integration tests, construct Memory exactly as production does (with storage)."],"tags":["memory","storage","semantic-recall","configuration"],"backgroundTag":"missing-storage-adapter","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}