{"record":{"id":"6223be4ec70ffdb9","repo":"mastra-ai/mastra","slug":"memory-store-is-required-for-channel-thread-mappin","errorCode":null,"errorMessage":"Memory store is required for channel thread mapping. Configure storage in your Mastra instance.","messagePattern":"Memory store is required for channel thread mapping\\. Configure storage in your Mastra instance\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/core/src/channels/agent-channels.ts","lineNumber":1611,"sourceCode":"  private async findThreadMapping({\n    externalThreadId,\n    channelId,\n    platform,\n    mastra,\n  }: {\n    externalThreadId: string;\n    channelId: string;\n    platform: string;\n    mastra: Mastra;\n  }) {\n    const storage = mastra.getStorage();\n    if (!storage) {\n      throw new Error('Storage is required for channel thread mapping. Configure storage in your Mastra instance.');\n    }\n\n    const memoryStore = await storage.getStore('memory');\n    if (!memoryStore) {\n      throw new Error(\n        'Memory store is required for channel thread mapping. Configure storage in your Mastra instance.',\n      );\n    }\n\n    const legacyMetadata = {\n      channel_platform: platform,\n      channel_externalThreadId: externalThreadId,\n      channel_externalChannelId: channelId,\n    };\n\n    const ownerId = this.getOwnerId();\n    if (ownerId === null) {\n      // No owner bound yet - scoping is impossible; behave exactly as before\n      // and never stamp a null owner id.\n      const { threads } = await memoryStore.listThreads({\n        filter: { metadata: legacyMetadata },\n        perPage: 1,\n      });","sourceCodeStart":1593,"sourceCodeEnd":1629,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/core/src/channels/agent-channels.ts#L1593-L1629","documentation":"This is the second check in the channel thread-mapping path: storage exists, but storage.getStore('memory') returned undefined, meaning the configured storage provider does not expose the memory store required to persist thread mappings. The method throws with a specific instruction.","triggerScenarios":"Using a storage provider that implements storage but not the memory store (e.g. a partial/minimal provider), or a misconfigured provider whose getStore('memory') fails to resolve, then invoking channel thread mapping.","commonSituations":"Custom storage implementations missing the memory store; providers where memory store support was added in a later version; configuring a store that only covers workflows or vectors.","solutions":["Use a storage provider with memory-store support (e.g. LibSQLStore) for channel workloads","Upgrade your storage package to a version that implements the memory store","Implement getStore('memory') in your custom storage adapter"],"exampleFix":"// before\nnew Mastra({ storage: customVectorOnlyStore }); // no memory store\n// after\nnew Mastra({ storage: new LibSQLStore({ url: 'file:./mastra.db' }) });","handlingStrategy":"validation","validationCode":"const storage = mastra.getStorage();\nconst memoryStore = storage ? await storage.getStore('memory') : undefined;\nif (!memoryStore) {\n  throw new Error('Storage provider must expose a memory store for channel thread mapping');\n}","typeGuard":"function hasMemoryStore(s: NonNullable<ReturnType<Mastra['getStorage']>>): boolean {\n  return !!s.getStore('memory');\n}","tryCatchPattern":"try {\n  await resolveChannelThread(args);\n} catch (err) {\n  if (err instanceof Error && err.message.startsWith('Memory store is required')) {\n    logger.error('Switch to a storage provider implementing the memory store (e.g. LibSQLStore)');\n  } else throw err;\n}","preventionTips":["Verify your provider's getStore('memory') during upgrade checks","Keep storage packages up to date for memory-store support","For custom stores, implement and test the memory store interface"],"tags":["storage","memory-store","channels"],"backgroundTag":"missing-storage-configuration","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}