{"record":{"id":"7bc3b66d7fa241e7","repo":"koala73/worldmonitor","slug":"backfillcanary250-canary-sent-at-ms-failed-date","errorCode":null,"errorMessage":"[backfillCanary250] CANARY_SENT_AT_MS failed Date.parse — check the literal.","messagePattern":"\\[backfillCanary250\\] CANARY_SENT_AT_MS failed Date\\.parse — check the literal\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"convex/broadcast/backfillCanaryWaveStamps.ts","lineNumber":134,"sourceCode":" * comfortably fits in well under a minute.\n *\n * All Resend addresses are normalized via the same `trim().toLowerCase()`\n * convention used at every write site — must match\n * `registrations.normalizedEmail` semantics or the join would silently\n * miss rows.\n */\nexport const backfillCanary250 = internalAction({\n  args: {},\n  handler: async (ctx): Promise<BackfillStats> => {\n    const apiKey = process.env.RESEND_API_KEY;\n    if (!apiKey) {\n      throw new Error(\n        \"[backfillCanary250] RESEND_API_KEY not set — run with the same env that hosts the canary segment.\",\n      );\n    }\n\n    if (!Number.isFinite(CANARY_SENT_AT_MS)) {\n      throw new Error(\n        \"[backfillCanary250] CANARY_SENT_AT_MS failed Date.parse — check the literal.\",\n      );\n    }\n\n    const stats: BackfillStats = {\n      fetched: 0,\n      stamped: 0,\n      alreadyStamped: 0,\n      notFound: 0,\n      failed: 0,\n    };\n\n    let after: string | null = null;\n    // eslint-disable-next-line no-constant-condition\n    while (true) {\n      // Resend's per-segment contact-listing endpoint is\n      // `GET /segments/{id}/contacts` (NOT `/contacts?segment_id=...`).\n      // The `/contacts` endpoint exists but its `segment_id` param is","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/koala73/worldmonitor/blob/ffec79ac339946fd2d24e85845da5755dcaa534b/convex/broadcast/backfillCanaryWaveStamps.ts#L116-L152","documentation":"Thrown by backfillCanary250 when CANARY_SENT_AT_MS is not a finite number after Date.parse — i.e. the compile-time literal in the file failed to parse into a valid timestamp. This is a source-code correctness check: the constant is a hardcoded literal that must represent a real date.","triggerScenarios":"The CANARY_SENT_AT_MS literal in backfillCanaryWaveStamps.ts is malformed (unparseable date string, NaN-producing expression). This fires at action runtime because Date.parse returns NaN for an invalid string.","commonSituations":"A developer edited the CANARY_SENT_AT_MS literal and introduced a typo or invalid date format; the literal was templated/interpolated incorrectly during a refactor; timezone or format mismatch in the literal.","solutions":["Open convex/broadcast/backfillCanaryWaveStamps.ts and fix the CANARY_SENT_AT_MS literal to a valid ISO 8601 date string or epoch milliseconds.","Verify with Date.parse(literal) in a REPL that it returns a finite number.","Re-run backfillCanary250 after redeploying the corrected constant."],"exampleFix":"// before (in source)\nconst CANARY_SENT_AT_MS = Date.parse(\"2024-13-99\"); // NaN\n// after\nconst CANARY_SENT_AT_MS = Date.parse(\"2024-10-15T12:00:00Z\"); // finite","handlingStrategy":"validation","validationCode":"// At source: ensure the literal parses\nconst CANARY_SENT_AT_MS = Date.parse(\"2024-10-15T12:00:00Z\");\nif (!Number.isFinite(CANARY_SENT_AT_MS)) {\n  throw new Error(\"CANARY_SENT_AT_MS literal is invalid — fix the source\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use ISO 8601 date literals in source.","Add a unit test asserting Number.isFinite(CANARY_SENT_AT_MS).","Review any change to the literal in code review."],"tags":["convex","broadcast","backfill","config","source-bug"],"backgroundTag":null,"analyzedSha":"ffec79ac339946fd2d24e85845da5755dcaa534b","analyzedAt":"2026-08-12T11:24:56.012Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}