{"record":{"id":"7d86d8f889a6b40c","repo":"koala73/worldmonitor","slug":"notice-not-found","errorCode":"NOTICE_NOT_FOUND","errorMessage":"NOTICE_NOT_FOUND","messagePattern":"NOTICE_NOT_FOUND","errorType":"error_code","errorClass":"ConvexError","httpStatus":null,"severity":"error","filePath":"convex/apiPlanLimitNotices.ts","lineNumber":431,"sourceCode":"        .collect();\n      notices.push(...rows.filter((notice) => notice.acknowledgedAt === undefined));\n    }\n    return notices.sort((a, b) => {\n      const severity = (state: ApiPlanLimitNoticeState) =>\n        state === \"over_limit\" ? 3 : state === \"sustained_burst\" ? 2 : 1;\n      const severityDiff = severity(b.state) - severity(a.state);\n      return severityDiff || b.lastSeenAt - a.lastSeenAt;\n    });\n  },\n});\n\nexport const acknowledgeNotice = mutation({\n  args: { noticeId: v.id(\"apiPlanLimitNotices\") },\n  handler: async (ctx, args) => {\n    const userId = await requireUserId(ctx);\n    const notice = await ctx.db.get(args.noticeId);\n    if (!notice || notice.userId !== userId) {\n      throw new ConvexError(\"NOTICE_NOT_FOUND\");\n    }\n    await ctx.db.patch(args.noticeId, { acknowledgedAt: Date.now() });\n    return { ok: true };\n  },\n});\n\nexport const listEmailDue = internalQuery({\n  args: {\n    now: v.number(),\n    limit: v.optional(v.number()),\n  },\n  handler: async (ctx, args) => {\n    const max = args.limit ?? 100;\n    // Scope to `current` in the INDEX so a backlog of superseded (current:false)\n    // pending/failed rows -- which sort first by oldest lastSeenAt -- can never\n    // consume the take() budget and starve genuinely-due live notices.\n    const pending = await ctx.db\n      .query(\"apiPlanLimitNotices\")","sourceCodeStart":413,"sourceCodeEnd":449,"githubUrl":"https://github.com/koala73/worldmonitor/blob/eeab0a219fce0f02a00603b532dbae9041b934ac/convex/apiPlanLimitNotices.ts#L413-L449","documentation":"Thrown by the acknowledgeNotice mutation: no apiPlanLimitNotices document matching the supplied noticeId exists for the current user (or at all). The acknowledgement cannot proceed because there is nothing to acknowledge.","triggerScenarios":"Thrown at convex/apiPlanLimitNotices.ts:431 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Re-fetch the pending notices list and acknowledge a current noticeId","Drop stale notice IDs in the client when the list refreshes so users cannot click outdated acknowledgements"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"eeab0a219fce0f02a00603b532dbae9041b934ac","analyzedAt":"2026-08-21T16:51:25.751Z","contentChangedAt":"2026-08-21T16:51:25.751Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}