mastra-ai/mastra · error
Storage does not have a memory domain configured
Error message
Storage does not have a memory domain configured
What it means
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.
Source
Thrown at packages/core/src/agent-controller/agent-controller.ts:982
await this.initStorage();
// Propagate harness-level Mastra, memory, workspace, browser, and pubsub
// to the agent(s) that back each mode. Workspaces initialize lazily when used.
for (const agent of this.backingAgents()) {
this.propagateRuntimeServicesToAgent(agent);
}
this.startIntervals();
}
private async getMemoryStorage(): Promise<MemoryStorage> {
const storage = this.#resolveStorage();
if (!storage) {
throw new Error('Storage is not configured on this AgentController');
}
const memoryStorage = await storage.getStore('memory');
if (!memoryStorage) {
throw new Error('Storage does not have a memory domain configured');
}
return memoryStorage;
}
/**
* The shared-host storage gateway the Session's thread domain reads/writes
* through. The Session owns the thread-domain logic; this adapter maps raw
* storage rows to AgentController types and uses the active session only when
* resolving configured memory for a clone.
*/
private createThreadDataStore(session: Session<TState>): ThreadDataStore {
return {
listThreads: ({ resourceId, includeForkedSubagents, metadata }) =>
this.queryThreads({ resourceId, includeForkedSubagents, metadata }),
getById: ({ threadId }) => this.queryThreadById({ threadId }),
listMessages: ({ threadId, limit }) => this.queryThreadMessages({ threadId, limit }),
firstUserMessages: ({ threadIds }) => this.queryFirstUserMessages({ threadIds }),
getMetadata: ({ threadId, key }) => this.readThreadMetadataValue({ threadId, key }),View on GitHub (pinned to 75dd419e61)
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')
Example fix
// before
storage: new WorkflowOnlyStorageAdapter(),
// after
storage: new MastraStorage({ store: new LibSQLStore({ url: process.env.DATABASE_URL }) }), Defensive patterns
Strategy: validation
Validate before calling
const storage = controller.config.storage;
if (storage && !(await storage.getStore('memory'))) throw new Error('storage lacks memory domain'); Try / catch
try {
const ms = await controller.memoryStorage;
return await ms.listThreads({ resourceId });
} catch (e) {
if (e instanceof Error && /memory domain/.test(e.message)) {
// switch to a full storage adapter or surface a config error
}
throw e;
} Prevention
- 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
When it happens
Trigger: 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).
Common situations: 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.
Related errors
- Storage is not configured on this AgentController
- Memory is not configured on this AgentController
- Memory requires a storage provider to function. Add a storag
- WORKING_MEMORY_MISSING_STORAGE_ADAPTER
- MESSAGE_HISTORY_MISSING_STORAGE_ADAPTER
AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30).
Data as JSON: /api/errors/1e2ad0ae1992b01e.
Report an issue: GitHub.