mastra-ai/mastra · error

notification_inbox requires a notifications storage domain

Error message

notification_inbox requires a notifications storage domain

What it means

`LazyNotificationsStorage` delegates every notification operation to a storage domain looked up lazily via `storage.getStore('notifications')`. If the composite store has no 'notifications' domain configured, every public method (`createNotification`, `listNotifications`, `listDueNotifications`, `getNotification`, `updateNotification`, `dangerouslyClearAll`) throws this error, because the notification_inbox tool cannot be backed by storage.

Source

Thrown at mastracode/sdk/src/agents/tools.ts:40

import { getWorkflowTool } from '../tools/workflows/get-workflow.js';
import { listWorkflowsTool } from '../tools/workflows/list-workflows.js';
import { runWorkflowTool } from '../tools/workflows/run-workflow.js';
import { WORKFLOW_MANAGEMENT_TOOL_IDS } from '../tools/workflows/tool-ids.js';

/** Minimal shape for tools passed to createDynamicTools. */
export type ToolLike = {
  execute?: (...args: any[]) => Promise<unknown> | unknown;
} & Record<string, any>;

export class LazyNotificationsStorage extends NotificationsStorage {
  constructor(private readonly storage: MastraCompositeStore) {
    super();
  }

  private async getNotificationsStorage(): Promise<NotificationsStorage> {
    const notifications = await this.storage.getStore('notifications');
    if (!notifications) {
      throw new Error('notification_inbox requires a notifications storage domain');
    }
    return notifications;
  }

  async createNotification(input: CreateNotificationInput) {
    return (await this.getNotificationsStorage()).createNotification(input);
  }

  async listNotifications(input: ListNotificationsInput) {
    return (await this.getNotificationsStorage()).listNotifications(input);
  }

  async listDueNotifications(input: ListDueNotificationsInput) {
    return (await this.getNotificationsStorage()).listDueNotifications(input);
  }

  async getNotification(input: { threadId: string; id: string }) {
    return (await this.getNotificationsStorage()).getNotification(input);

View on GitHub (pinned to 75dd419e61)

Solutions

  1. Configure storage so a `notifications` domain exists — register/provision the notifications store on the `MastraCompositeStore` (e.g. `storage.registerStore(new NotificationsStore(...))` per the version's storage setup docs).
  2. Use a storage backend that supports the notifications domain (upgraded Mastra storage package) and verify with `await storage.getStore('notifications')` at startup.
  3. Gate the notification_inbox tool out of the agent's tool list when notifications storage is not configured.
  4. Check that the store key is exactly 'notifications' and the domain registration happened before agent execution.
  5. Add a startup assertion/log so misconfiguration surfaces at boot instead of at first tool call.

Example fix

// before
const storage = new MastraCompositeStore({ stores: { agents: agentsStore } }); // no notifications domain
// after
const storage = new MastraCompositeStore({ stores: { agents: agentsStore, notifications: notificationsStore } });
Defensive patterns

Strategy: try-catch

Validate before calling

const notifications = await storage.getStore('notifications');
if (!notifications) throw new Error('notification_inbox unavailable: no notifications storage domain configured');

Type guard

async function hasNotificationsDomain(storage: MastraCompositeStore): Promise<boolean> {
  return (await storage.getStore('notifications')) != null;
}

Try / catch

try {
  await notificationsTool.createNotification(input);
} catch (err) {
  if (err instanceof Error && err.message.includes('requires a notifications storage domain')) {
    logger.warn('notifications storage not configured; skipping notification');
  } else {
    throw err;
  }
}

Prevention

When it happens

Trigger: Invoking any notification_inbox tool operation when the underlying `MastraCompositeStore` was created without a `notifications` domain (no store registered/provisioned for that key); e.g. storage configured with only default domains, or a custom store that does not expose notifications.

Common situations: Enabling the notification_inbox agent tool while the app's Mastra storage is configured without notifications support; switching storage backends (e.g. to an in-memory or older store version) that lacks the notifications domain; forgetting to register the notifications store in DI/config after a version upgrade.

Related errors


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