mastra-ai/mastra · error · Error

ExperimentsStorage not configured.

Error message

ExperimentsStorage not configured.

What it means

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.

Source

Thrown at packages/core/src/datasets/experiment/analytics/compare.ts:69

 *   console.log('Quality regression detected!');
 * }
 * ```
 */
export async function compareExperiments(mastra: Mastra, config: CompareExperimentsConfig): Promise<ComparisonResult> {
  const { experimentIdA, experimentIdB, thresholds = {} } = config;
  const warnings: string[] = [];

  // 1. Get storage
  const storage = mastra.getStorage();
  if (!storage) {
    throw new Error('Storage not configured. Configure storage in Mastra instance.');
  }

  const experimentsStore = await storage.getStore('experiments');
  const scoresStore = await storage.getStore('scores');

  if (!experimentsStore) {
    throw new Error('ExperimentsStorage not configured.');
  }
  if (!scoresStore) {
    throw new Error('ScoresStorage not configured.');
  }

  // 2. Load both experiments
  const [experimentA, experimentB] = await Promise.all([
    experimentsStore.getExperimentById({ id: experimentIdA }),
    experimentsStore.getExperimentById({ id: experimentIdB }),
  ]);

  if (!experimentA) {
    throw new Error(`Experiment not found: ${experimentIdA}`);
  }
  if (!experimentB) {
    throw new Error(`Experiment not found: ${experimentIdB}`);
  }

View on GitHub (pinned to 75dd419e61)

Solutions

  1. Use a storage backend that implements the experiments domain store (or upgrade to a version that does)
  2. Run any storage schema initialization/migration your adapter requires
  3. Log/storage-inspect mastra.getStorage().getStore('experiments') to confirm it resolves
  4. Verify no custom getStore override filters out the 'experiments' domain

Example fix

// before
storage: new MyMinimalStore() // no experiments domain
// after
storage: new LibSQLStore({ url: 'file:./mastra.db' }) // supports experiments store
Defensive patterns

Strategy: validation

Validate before calling

const storage = mastra.getStorage();
if (!storage || !(await storage.getStore('experiments'))) throw new Error('Storage backend does not provide an experiments store');

Type guard

function hasExperimentsStore(s) { return s != null && typeof s.getStore === 'function'; } // then await s.getStore('experiments') and check non-null

Try / catch

try {
  const report = await compareExperiments({ mastra, config });
} catch (e) {
  if (e instanceof Error && /ExperimentsStorage not configured/i.test(e.message)) {
    // swap to a storage adapter that implements the experiments domain
  } else throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30). Data as JSON: /api/errors/2a8940d524441c56. Report an issue: GitHub.