mastra-ai/mastra · error · MastraError

DATASETS_STORE_NOT_AVAILABLE

DATASETS_STORE_NOT_AVAILABLE

Error message

Datasets store not available. Ensure your storage adapter provides a datasets domain.

What it means

Storage IS configured, but storage.getStore('datasets') returned nothing — the adapter does not implement the datasets domain. #getDatasetsStore throws DATASETS_STORE_NOT_AVAILABLE so callers know their storage backend lacks dataset support rather than failing later with undefined behavior.

Source

Thrown at packages/core/src/datasets/manager.ts:61

  // Lazy storage resolution
  // ---------------------------------------------------------------------------

  async #getDatasetsStore(): Promise<DatasetsStorage> {
    if (this.#datasetsStore) return this.#datasetsStore;

    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('datasets');
    if (!store) {
      throw new MastraError({
        id: 'DATASETS_STORE_NOT_AVAILABLE',
        text: 'Datasets store not available. Ensure your storage adapter provides a datasets domain.',
        domain: 'STORAGE',
        category: 'USER',
      });
    }

    this.#datasetsStore = store;
    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',

View on GitHub (pinned to 75dd419e61)

Solutions

  1. Upgrade the storage adapter package to a version implementing the datasets domain.
  2. Switch to an adapter known to support datasets (e.g. libsql/pg-based official stores).
  3. If using a custom adapter, implement and register the datasets domain store.
  4. Feature-detect at startup: if (!(await storage.getStore('datasets'))) log/throw early.

Example fix

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

Strategy: validation

Validate before calling

const store = await mastra.getStorage()?.getStore('datasets');
if (!store) throw new Error('Current storage adapter does not provide a datasets domain');

Type guard

async function datasetsSupported(m: Mastra): Promise<boolean> {
  return !!(await m.getStorage()?.getStore('datasets'));
}

Try / catch

try {
  await datasets.create({ name: 'evals' });
} catch (err) {
  if (err?.id === 'DATASETS_STORE_NOT_AVAILABLE') {
    logger.error('Upgrade/replace storage adapter to one with datasets support');
  }
  throw err;
}

Prevention

When it happens

Trigger: Using an older or minimal storage adapter without a datasets domain store; a custom storage implementation that omits the datasets capability; getStore('datasets') returning undefined due to domain registration failure.

Common situations: Upgrading @mastra/core datasets features while keeping an old @mastra/* storage package; hand-rolled storage adapters; in-memory dev adapters without datasets support.

Related errors


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