{"record":{"id":"c5a93ea206ab3b95","repo":"mastra-ai/mastra","slug":"memory-storage-domain-is-not-available-on-this-s","errorCode":null,"errorMessage":"Memory storage domain is not available on ${this.storage.constructor.name}","messagePattern":"Memory storage domain is not available on (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/memory/src/index.ts","lineNumber":558,"sourceCode":"          vector: this.vector!,\n          embedder: this.embedder!,\n          embedderOptions: this.embedderOptions,\n        }),\n    );\n    return this._knowledgeSemanticIndex;\n  }\n\n  public async drainKnowledgeSemanticIndex(scope?: KnowledgeScope): Promise<number> {\n    return (await this.getKnowledgeSemanticIndex()).drain(scope);\n  }\n\n  /**\n   * Gets the memory storage domain, throwing if not available.\n   */\n  protected async getMemoryStore(): Promise<MemoryStorage> {\n    const store = await this.storage.getStore('memory');\n    if (!store) {\n      throw new Error(`Memory storage domain is not available on ${this.storage.constructor.name}`);\n    }\n    return store;\n  }\n\n  async listMessagesByResourceId(args: StorageListMessagesByResourceIdInput): Promise<StorageListMessagesOutput> {\n    const memoryStore = await this.getMemoryStore();\n    return memoryStore.listMessagesByResourceId(args);\n  }\n\n  protected async validateThreadIsOwnedByResource(threadId: string, resourceId: string, config: MemoryConfigInternal) {\n    const resourceScope =\n      (typeof config?.semanticRecall === 'object' && config?.semanticRecall?.scope !== `thread`) ||\n      config.semanticRecall === true;\n\n    const thread = await this.getThreadById({ threadId });\n\n    // For resource-scoped semantic recall, we don't need to validate that the specific thread exists\n    // because we're searching across all threads for the resource","sourceCodeStart":540,"sourceCodeEnd":576,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/memory/src/index.ts#L540-L576","documentation":"Memory methods need the 'memory' storage domain, fetched via this.storage.getStore('memory'). When the configured Storage class does not expose a memory domain (returns undefined), this error is thrown. It indicates the storage backend is incompatible or misconfigured rather than that data is missing.","triggerScenarios":"Calling any Memory method that touches messages/threads (e.g. listMessagesByResourceId, remember, recall) when this.storage is a class whose getStore('memory') returns undefined — e.g. a custom/incomplete Storage implementation, a legacy storage adapter predating domain stores, or passing a non-Mastra storage object.","commonSituations":"Using an outdated @mastra/storage version with a newer @mastra/core memory that expects domain stores; implementing a custom Storage class without a memory domain; passing the wrong object (e.g. a vector store) as storage.","solutions":["Upgrade @mastra/* storage packages so the Storage class implements domain stores including 'memory'","Use an official storage backend (LibSQLStore, PostgresStore, UpstashStore, etc.) instead of a custom or partial implementation","If custom storage, implement getStore('memory') returning a MemoryStorage domain"],"exampleFix":"// before\nconst memory = new Memory({ storage: new MyCustomStore() });\n// after\nconst memory = new Memory({ storage: new LibSQLStore({ url: 'file:./mastra.db' }) });","handlingStrategy":"validation","validationCode":"const store = await storage.getStore('memory');\nif (!store) throw new Error('Storage backend does not provide a memory domain; use an official @mastra storage package');","typeGuard":"function hasMemoryDomain(s: unknown): s is { getStore: (d: string) => Promise<unknown> } {\n  return typeof s === 'object' && s !== null && 'getStore' in s;\n}","tryCatchPattern":null,"preventionTips":["Use official storage backends (LibSQLStore, PostgresStore, etc.)","Keep @mastra/storage and @mastra/memory versions in sync","Write an integration test that constructs Memory with your storage and calls a read method"],"tags":["memory","storage","configuration","version-mismatch"],"backgroundTag":"missing-storage-domain","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}