mastra-ai/mastra · error · MastraError

EXPERIMENTS_STORE_NOT_AVAILABLE

EXPERIMENTS_STORE_NOT_AVAILABLE

Error message

Experiments store not available. Ensure your storage adapter provides an experiments domain.

What it means

Storage is configured but does not provide an `experiments` store. #getExperimentsStore() throws EXPERIMENTS_STORE_NOT_AVAILABLE when storage.getStore('experiments') returns undefined. The adapter must implement the experiments domain for experiment features to work.

Source

Thrown at packages/core/src/datasets/dataset.ts:106

    return store;
  }

  async #getExperimentsStore(): Promise<ExperimentsStorage> {
    if (this.#experimentsStore) return this.#experimentsStore;

    const storage = this.#mastra.getStorage();
    if (!storage) {
      throw new MastraError({
        id: 'DATASETS_STORAGE_NOT_CONFIGURED',
        text: 'Storage not configured. Configure storage in Mastra instance.',
        domain: 'STORAGE',
        category: 'USER',
      });
    }

    const store = await storage.getStore('experiments');
    if (!store) {
      throw new MastraError({
        id: 'EXPERIMENTS_STORE_NOT_AVAILABLE',
        text: 'Experiments store not available. Ensure your storage adapter provides an experiments domain.',
        domain: 'STORAGE',
        category: 'USER',
      });
    }

    this.#experimentsStore = store;
    return store;
  }

  /**
   * Preflight tenancy gate for storage APIs whose signatures don't accept
   * `filters`. When the handle has a `#scope`, a scoped `getDatasetById` is
   * used to prove the dataset exists in the caller's tenancy; on miss we
   * throw NOT_FOUND, mirroring {@link Dataset.getDetails}. Callers that must
   * return a non-throwing empty result (e.g. list endpoints) should catch and
   * translate.

View on GitHub (pinned to 75dd419e61)

Solutions

  1. Upgrade your storage adapter package to a version implementing the experiments domain.
  2. Switch to an adapter that supports experiments (recent libsql/pg/upstash releases).
  3. For custom storage, implement the experiments domain store.
  4. As a workaround for read-only dataset use, avoid experiment APIs or set persistence.experiments='none' where applicable.

Example fix

// before
const store = await storage.getStore('experiments'); // undefined on old adapter
// after
pnpm add @mastra/pg@latest  # adapter now implements getStore('experiments')
Defensive patterns

Strategy: validation

Validate before calling

const store = await storage.getStore?.('experiments');
if (!store) throw new Error('Storage adapter lacks experiments domain');

Type guard

null

Try / catch

try { await dataset.startExperimentAsync(cfg); } catch (e) { if (e?.id === 'EXPERIMENTS_STORE_NOT_AVAILABLE') { /* upgrade adapter or set persistence.experiments='none' */ } else throw e; }

Prevention

When it happens

Trigger: Calling experimentsStore or any experiment-persisting Dataset API against a storage adapter lacking the experiments domain (getStore('experiments') yields undefined).

Common situations: Storage adapter version older than the experiments domain; custom storage implementations; mixing a new core with an old adapter package.

Related errors


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