{"record":{"id":"1e2ad0ae1992b01e","repo":"mastra-ai/mastra","slug":"storage-does-not-have-a-memory-domain-configured","errorCode":null,"errorMessage":"Storage does not have a memory domain configured","messagePattern":"Storage does not have a memory domain configured","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/core/src/agent-controller/agent-controller.ts","lineNumber":982,"sourceCode":"    await this.initStorage();\n\n    // Propagate harness-level Mastra, memory, workspace, browser, and pubsub\n    // to the agent(s) that back each mode. Workspaces initialize lazily when used.\n    for (const agent of this.backingAgents()) {\n      this.propagateRuntimeServicesToAgent(agent);\n    }\n\n    this.startIntervals();\n  }\n\n  private async getMemoryStorage(): Promise<MemoryStorage> {\n    const storage = this.#resolveStorage();\n    if (!storage) {\n      throw new Error('Storage is not configured on this AgentController');\n    }\n    const memoryStorage = await storage.getStore('memory');\n    if (!memoryStorage) {\n      throw new Error('Storage does not have a memory domain configured');\n    }\n    return memoryStorage;\n  }\n\n  /**\n   * The shared-host storage gateway the Session's thread domain reads/writes\n   * through. The Session owns the thread-domain logic; this adapter maps raw\n   * storage rows to AgentController types and uses the active session only when\n   * resolving configured memory for a clone.\n   */\n  private createThreadDataStore(session: Session<TState>): ThreadDataStore {\n    return {\n      listThreads: ({ resourceId, includeForkedSubagents, metadata }) =>\n        this.queryThreads({ resourceId, includeForkedSubagents, metadata }),\n      getById: ({ threadId }) => this.queryThreadById({ threadId }),\n      listMessages: ({ threadId, limit }) => this.queryThreadMessages({ threadId, limit }),\n      firstUserMessages: ({ threadIds }) => this.queryFirstUserMessages({ threadIds }),\n      getMetadata: ({ threadId, key }) => this.readThreadMetadataValue({ threadId, key }),","sourceCodeStart":964,"sourceCodeEnd":1000,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/core/src/agent-controller/agent-controller.ts#L964-L1000","documentation":"Storage IS configured, but storage.getStore('memory') returned no memory domain. Some storage backends can be created without the memory store, so any memory-domain operation (threads/messages) fails even though storage exists.","triggerScenarios":"Calling memoryStorage/memory/result APIs on an AgentController whose configured storage does not expose a 'memory' store (e.g. a storage adapter registered only for workflows/traces domains).","commonSituations":"Using a custom or partial storage adapter that omits the memory domain; constructing a shared storage gateway but only wiring non-memory domains; version mismatch where an old storage package lacks memory support.","solutions":["Use a storage backend that includes the memory domain (all standard Mastra storage adapters do), or register the memory store on the adapter","Upgrade the storage package if your version predates memory-domain support","Pass config.memory on the controller instead of relying on storage.getStore('memory')"],"exampleFix":"// before\nstorage: new WorkflowOnlyStorageAdapter(),\n// after\nstorage: new MastraStorage({ store: new LibSQLStore({ url: process.env.DATABASE_URL }) }),","handlingStrategy":"validation","validationCode":"const storage = controller.config.storage;\nif (storage && !(await storage.getStore('memory'))) throw new Error('storage lacks memory domain');","typeGuard":null,"tryCatchPattern":"try {\n  const ms = await controller.memoryStorage;\n  return await ms.listThreads({ resourceId });\n} catch (e) {\n  if (e instanceof Error && /memory domain/.test(e.message)) {\n    // switch to a full storage adapter or surface a config error\n  }\n  throw e;\n}","preventionTips":["Use standard Mastra storage adapters that ship all domains rather than custom partial adapters","Smoke-test storage.getStore('memory') during app bootstrapping","Pin storage package versions compatible with your core version"],"tags":["configuration","storage","memory"],"backgroundTag":"storage-domain-missing","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T08:17:16.595Z"}