{"record":{"id":"2a8940d524441c56","repo":"mastra-ai/mastra","slug":"experimentsstorage-not-configured","errorCode":null,"errorMessage":"ExperimentsStorage not configured.","messagePattern":"ExperimentsStorage not configured\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/datasets/experiment/analytics/compare.ts","lineNumber":69,"sourceCode":" *   console.log('Quality regression detected!');\n * }\n * ```\n */\nexport async function compareExperiments(mastra: Mastra, config: CompareExperimentsConfig): Promise<ComparisonResult> {\n  const { experimentIdA, experimentIdB, thresholds = {} } = config;\n  const warnings: string[] = [];\n\n  // 1. Get storage\n  const storage = mastra.getStorage();\n  if (!storage) {\n    throw new Error('Storage not configured. Configure storage in Mastra instance.');\n  }\n\n  const experimentsStore = await storage.getStore('experiments');\n  const scoresStore = await storage.getStore('scores');\n\n  if (!experimentsStore) {\n    throw new Error('ExperimentsStorage not configured.');\n  }\n  if (!scoresStore) {\n    throw new Error('ScoresStorage not configured.');\n  }\n\n  // 2. Load both experiments\n  const [experimentA, experimentB] = await Promise.all([\n    experimentsStore.getExperimentById({ id: experimentIdA }),\n    experimentsStore.getExperimentById({ id: experimentIdB }),\n  ]);\n\n  if (!experimentA) {\n    throw new Error(`Experiment not found: ${experimentIdA}`);\n  }\n  if (!experimentB) {\n    throw new Error(`Experiment not found: ${experimentIdB}`);\n  }\n","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/core/src/datasets/experiment/analytics/compare.ts#L51-L87","documentation":"Storage is configured but does not expose the experiments domain store, which compareExperiments needs to load both experiment records. getStore('experiments') returned falsy, meaning the configured storage backend lacks experiments support or it is not registered.","triggerScenarios":"Calling compareExperiments when storage.getStore('experiments') returns null/undefined — e.g. a storage backend without the experiments domain, a partially configured storage, or an incompatible storage version.","commonSituations":"Using a storage adapter that predates experiments support; custom storage implementations missing the experiments store; storage configured but domains not initialized/upgraded; wrong storage instance attached to Mastra.","solutions":["Use a storage backend that implements the experiments domain store (or upgrade to a version that does)","Run any storage schema initialization/migration your adapter requires","Log/storage-inspect mastra.getStorage().getStore('experiments') to confirm it resolves","Verify no custom getStore override filters out the 'experiments' domain"],"exampleFix":"// before\nstorage: new MyMinimalStore() // no experiments domain\n// after\nstorage: new LibSQLStore({ url: 'file:./mastra.db' }) // supports experiments store","handlingStrategy":"validation","validationCode":"const storage = mastra.getStorage();\nif (!storage || !(await storage.getStore('experiments'))) throw new Error('Storage backend does not provide an experiments store');","typeGuard":"function hasExperimentsStore(s) { return s != null && typeof s.getStore === 'function'; } // then await s.getStore('experiments') and check non-null","tryCatchPattern":"try {\n  const report = await compareExperiments({ mastra, config });\n} catch (e) {\n  if (e instanceof Error && /ExperimentsStorage not configured/i.test(e.message)) {\n    // swap to a storage adapter that implements the experiments domain\n  } else throw e;\n}","preventionTips":["Choose a storage adapter documented to support the experiments domain","Run storage migrations/initialization on deploy","Smoke-test getStore('experiments') in your health checks"],"tags":["storage","configuration","experiments","analytics"],"backgroundTag":"storage-domain-not-configured","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}