koala73/worldmonitor · critical · Error
[backfillCanary250] CANARY_SENT_AT_MS failed Date.parse — ch
Error message
[backfillCanary250] CANARY_SENT_AT_MS failed Date.parse — check the literal.
What it means
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.
Source
Thrown at convex/broadcast/backfillCanaryWaveStamps.ts:134
* comfortably fits in well under a minute.
*
* All Resend addresses are normalized via the same `trim().toLowerCase()`
* convention used at every write site — must match
* `registrations.normalizedEmail` semantics or the join would silently
* miss rows.
*/
export const backfillCanary250 = internalAction({
args: {},
handler: async (ctx): Promise<BackfillStats> => {
const apiKey = process.env.RESEND_API_KEY;
if (!apiKey) {
throw new Error(
"[backfillCanary250] RESEND_API_KEY not set — run with the same env that hosts the canary segment.",
);
}
if (!Number.isFinite(CANARY_SENT_AT_MS)) {
throw new Error(
"[backfillCanary250] CANARY_SENT_AT_MS failed Date.parse — check the literal.",
);
}
const stats: BackfillStats = {
fetched: 0,
stamped: 0,
alreadyStamped: 0,
notFound: 0,
failed: 0,
};
let after: string | null = null;
// eslint-disable-next-line no-constant-condition
while (true) {
// Resend's per-segment contact-listing endpoint is
// `GET /segments/{id}/contacts` (NOT `/contacts?segment_id=...`).
// The `/contacts` endpoint exists but its `segment_id` param isView on GitHub (pinned to ffec79ac33)
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.
Example fix
// before (in source)
const CANARY_SENT_AT_MS = Date.parse("2024-13-99"); // NaN
// after
const CANARY_SENT_AT_MS = Date.parse("2024-10-15T12:00:00Z"); // finite Defensive patterns
Strategy: validation
Validate before calling
// At source: ensure the literal parses
const CANARY_SENT_AT_MS = Date.parse("2024-10-15T12:00:00Z");
if (!Number.isFinite(CANARY_SENT_AT_MS)) {
throw new Error("CANARY_SENT_AT_MS literal is invalid — fix the source");
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- [backfillCanary250] RESEND_API_KEY not set — run with the sa
- [backfillCanary250] Resend list-contacts ${res.status}: ${bo
- [backfillCanary250] unexpected Resend response shape: ${JSON
- [initRamp] rampCurve must be non-empty
- [initRamp] seedLastWaveBroadcastId and seedLastWaveSentAt mu
AI-assisted analysis of koala73/worldmonitor@ffec79ac33 (2026-08-12).
Data as JSON: /api/errors/7bc3b66d7fa241e7.
Report an issue: GitHub.