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 its adapter does not expose a `datasets` store. #getDatasetsStore() calls storage.getStore('datasets') and throws DATASETS_STORE_NOT_AVAILABLE when it returns undefined/null. This indicates an unsupported or older storage adapter lacking the datasets domain.

Source

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

  // 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 your @mastra/storage adapter (libsql/pg/upstash/etc.) to a version that implements the datasets domain.
  2. Switch to an officially supported adapter that provides the datasets store.
  3. If using custom storage, implement and register the datasets domain store in your adapter.

Example fix

// before
storage: new MastraLibsqlStorage({ url: 'file:./old.db' }) // outdated adapter version
// after
pnpm add @mastra/libsql@latest  # then reuse the same storage config
Defensive patterns

Strategy: validation

Validate before calling

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

Type guard

function hasDatasetsStore(s: unknown): s is { getStore: (d: 'datasets') => Promise<unknown> } { return typeof s === 'object' && s !== null && typeof (s as any).getStore === 'function'; }

Try / catch

try { await dataset.listItems(); } catch (e) { if (e?.id === 'DATASETS_STORE_NOT_AVAILABLE') { /* upgrade adapter */ } else throw e; }

Prevention

When it happens

Trigger: Calling any Dataset API against a storage adapter that has not implemented the datasets domain, so getStore('datasets') returns undefined.

Common situations: Using an older/custom storage adapter predating datasets support; upgrading Mastra core without upgrading the storage package; using a minimal in-house storage implementation.

Related errors


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