{"record":{"id":"7641367085e44041","repo":"mastra-ai/mastra","slug":"notification-inbox-input-action-requires-id","errorCode":null,"errorMessage":"notification-inbox ${input.action} requires id","messagePattern":"notification-inbox (.+?) requires id","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/core/src/notifications/tool.ts","lineNumber":148,"sourceCode":"          : await storage.listNotifications({\n              threadId,\n              status: input.status ?? ['pending', 'delivered'],\n              priority: input.priority,\n              source: input.source,\n              limit: input.limit,\n            });\n        if (input.id && !notifications[0])\n          throw new Error(`Notification ${input.id} was not found for thread ${threadId}`);\n        return deliverNotifications({\n          notifications: notifications.filter((notification): notification is NotificationRecord =>\n            Boolean(notification),\n          ),\n          storage,\n          context,\n        });\n      }\n\n      if (!input.id) throw new Error(`notification-inbox ${input.action} requires id`);\n      const statusByAction = {\n        markSeen: 'seen',\n        dismiss: 'dismissed',\n        archive: 'archived',\n      } satisfies Record<'markSeen' | 'dismiss' | 'archive', NotificationStatus>;\n\n      return {\n        notification: await storage.updateNotification({\n          threadId,\n          id: input.id,\n          status: statusByAction[input.action],\n        }),\n      };\n    },\n  });\n}\n","sourceCodeStart":130,"sourceCodeEnd":165,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/core/src/notifications/tool.ts#L130-L165","documentation":"Actions markSeen, dismiss, and archive operate on a single notification and therefore require input.id. The tool throws this error when the action is one of these but no id was supplied.","triggerScenarios":"Invoking the notification-inbox tool with action 'markSeen', 'dismiss', or 'archive' while omitting input.id — commonly when the LLM emits partial tool arguments or a UI button click sends an action without the selected notification id.","commonSituations":"Model-generated tool calls missing required fields despite the schema; frontend dispatching actions with stale/undefined state; writing tests against the tool with incomplete inputs.","solutions":["Always include id in the tool input for markSeen/dismiss/archive actions","Enforce the input schema (notificationActionSchema) at the UI/client layer before invoking the tool","If the LLM omits id, re-prompt or reject the tool call; check tool choice/strict schema settings"],"exampleFix":"// before\nawait inboxTool.execute({ action: 'dismiss', threadId });\n// after\nawait inboxTool.execute({ action: 'dismiss', threadId, id: notificationId });","handlingStrategy":"validation","validationCode":"const idActions = ['markSeen', 'dismiss', 'archive'] as const;\nif (idActions.includes(input.action as any) && !input.id) {\n  throw new Error(`Action ${input.action} requires a notification id`);\n}","typeGuard":"function hasId(i: NotificationInboxAction): i is NotificationInboxAction & { id: string } {\n  return typeof (i as any).id === 'string' && (i as any).id.length > 0;\n}","tryCatchPattern":"try {\n  await inboxTool.execute(input, context);\n} catch (e) {\n  if (e instanceof Error && e.message.includes('requires id')) {\n    logger.warn('Tool call missing id', { action: input.action });\n    return { error: 'Select a notification first' };\n  }\n  throw e;\n}","preventionTips":["Always include the notification id in markSeen/dismiss/archive calls","Validate inputs at the client boundary before invoking the tool","Use strict tool-call schemas so the model cannot omit id"],"tags":["notifications","tool","missing-argument"],"backgroundTag":"missing-required-parameter","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}