{"record":{"id":"c4b09a2e5770f7bf","repo":"mastra-ai/mastra","slug":"notification-inbox-requires-a-notifications-storag","errorCode":null,"errorMessage":"notification_inbox requires a notifications storage domain","messagePattern":"notification_inbox requires a notifications storage domain","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"mastracode/sdk/src/agents/tools.ts","lineNumber":40,"sourceCode":"import { getWorkflowTool } from '../tools/workflows/get-workflow.js';\nimport { listWorkflowsTool } from '../tools/workflows/list-workflows.js';\nimport { runWorkflowTool } from '../tools/workflows/run-workflow.js';\nimport { WORKFLOW_MANAGEMENT_TOOL_IDS } from '../tools/workflows/tool-ids.js';\n\n/** Minimal shape for tools passed to createDynamicTools. */\nexport type ToolLike = {\n  execute?: (...args: any[]) => Promise<unknown> | unknown;\n} & Record<string, any>;\n\nexport class LazyNotificationsStorage extends NotificationsStorage {\n  constructor(private readonly storage: MastraCompositeStore) {\n    super();\n  }\n\n  private async getNotificationsStorage(): Promise<NotificationsStorage> {\n    const notifications = await this.storage.getStore('notifications');\n    if (!notifications) {\n      throw new Error('notification_inbox requires a notifications storage domain');\n    }\n    return notifications;\n  }\n\n  async createNotification(input: CreateNotificationInput) {\n    return (await this.getNotificationsStorage()).createNotification(input);\n  }\n\n  async listNotifications(input: ListNotificationsInput) {\n    return (await this.getNotificationsStorage()).listNotifications(input);\n  }\n\n  async listDueNotifications(input: ListDueNotificationsInput) {\n    return (await this.getNotificationsStorage()).listDueNotifications(input);\n  }\n\n  async getNotification(input: { threadId: string; id: string }) {\n    return (await this.getNotificationsStorage()).getNotification(input);","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/mastracode/sdk/src/agents/tools.ts#L22-L58","documentation":"`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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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).","Use a storage backend that supports the notifications domain (upgraded Mastra storage package) and verify with `await storage.getStore('notifications')` at startup.","Gate the notification_inbox tool out of the agent's tool list when notifications storage is not configured.","Check that the store key is exactly 'notifications' and the domain registration happened before agent execution.","Add a startup assertion/log so misconfiguration surfaces at boot instead of at first tool call."],"exampleFix":"// before\nconst storage = new MastraCompositeStore({ stores: { agents: agentsStore } }); // no notifications domain\n// after\nconst storage = new MastraCompositeStore({ stores: { agents: agentsStore, notifications: notificationsStore } });","handlingStrategy":"try-catch","validationCode":"const notifications = await storage.getStore('notifications');\nif (!notifications) throw new Error('notification_inbox unavailable: no notifications storage domain configured');","typeGuard":"async function hasNotificationsDomain(storage: MastraCompositeStore): Promise<boolean> {\n  return (await storage.getStore('notifications')) != null;\n}","tryCatchPattern":"try {\n  await notificationsTool.createNotification(input);\n} catch (err) {\n  if (err instanceof Error && err.message.includes('requires a notifications storage domain')) {\n    logger.warn('notifications storage not configured; skipping notification');\n  } else {\n    throw err;\n  }\n}","preventionTips":["Register the notifications store on the composite storage at app bootstrap","Probe `storage.getStore('notifications')` at startup and fail fast if absent","Only include the notification_inbox tool in agents when notifications storage is configured","Re-verify domain registration after storage backend upgrades or swaps"],"tags":["storage","configuration","notifications"],"backgroundTag":"missing-storage-domain","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}