mastra-ai/mastra · error · Error

ScoresStorage not configured.

Error message

ScoresStorage not configured.

What it means

compareExperiments needs the scores store to read per-item scores for both experiments. The configured storage returned falsy for getStore('scores'), so score comparison cannot run even though experiments storage may be present.

Source

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

 */
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}`);
  }

  // 3. Check version mismatch
  const versionMismatch = experimentA.datasetVersion !== experimentB.datasetVersion;
  if (versionMismatch) {

View on GitHub (pinned to 75dd419e61)

Solutions

  1. Use a storage backend implementing the scores domain store, or upgrade the adapter
  2. Run storage initialization/migrations so the scores domain is available
  3. Verify getStore('scores') resolves before calling compareExperiments
  4. Point Mastra at the storage instance that actually holds the experiment scores

Example fix

// before
storage: new ExperimentsOnlyStore() // scores missing
// after
storage: new PgStore({ connectionString: process.env.DATABASE_URL }) // full domains incl. scores
Defensive patterns

Strategy: validation

Validate before calling

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

Type guard

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

Try / catch

try {
  const report = await compareExperiments({ mastra, config });
} catch (e) {
  if (e instanceof Error && /ScoresStorage not configured/i.test(e.message)) {
    // switch to full-featured storage with scores support
  } else throw e;
}

Prevention

When it happens

Trigger: Calling compareExperiments when storage.getStore('scores') returns null/undefined — storage backend lacking scores support, domains not initialized, or an older/limited storage adapter.

Common situations: Storage adapter without scores domain; custom storage that implements experiments but not scores; storage schema migrations not run; experiments recorded elsewhere while the current storage has no scores table.

Related errors


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