{"record":{"id":"57c1728c180bd3c8","repo":"koala73/worldmonitor","slug":"activation-session-start-must-be-a-positive-safe-i","errorCode":null,"errorMessage":"activation session start must be a positive safe integer within the allowed future clock skew","messagePattern":"activation session start must be a positive safe integer within the allowed future clock skew","errorType":"validation","errorClass":"ConvexError","httpStatus":null,"severity":"error","filePath":"convex/payments/billing.ts","lineNumber":846,"sourceCode":"    // re-create the blind spot this record exists to close.\n    if (\n      subscription === null ||\n      subscription.userId !== userId ||\n      !isProActivationPlan(subscription.planKey)\n    ) {\n      return { status: \"not_eligible\" as const };\n    }\n\n    const now = Date.now();\n    if (\n      args.sessionStartedAt !== undefined &&\n      (\n        !Number.isSafeInteger(args.sessionStartedAt) ||\n        args.sessionStartedAt <= 0 ||\n        args.sessionStartedAt > now + MAX_PRO_ACTIVATION_SESSION_FUTURE_SKEW_MS\n      )\n    ) {\n      throw new ConvexError(\n        \"activation session start must be a positive safe integer within the allowed future clock skew\",\n      );\n    }\n\n    const existing = await activationPresentationForCohort(ctx, args.activationKey, \"day0\");\n    if (existing === null) {\n      await ctx.db.insert(\"proActivationPresentations\", {\n        userId,\n        subscriptionId: args.activationKey,\n        cohort: \"day0\",\n        claimNonce: args.claimNonce,\n        claimedAt: now,\n        ...(args.sessionStartedAt !== undefined\n          ? { sessionStartedAt: args.sessionStartedAt }\n          : {}),\n        // Day-0 has no confirm handshake, so presentation is recorded here —\n        // before the interstitial renders — to keep a subscriber who closes\n        // the tab immediately inside the cohort instead of invisible.","sourceCodeStart":828,"sourceCodeEnd":864,"githubUrl":"https://github.com/koala73/worldmonitor/blob/9361220cc013571781071f0206e4d80fd14b2f7f/convex/payments/billing.ts#L828-L864","documentation":"ConvexError guard in the Pro activation presentation flow validating the optional sessionStartedAt argument: it must be a positive safe integer not further in the future than MAX_PRO_ACTIVATION_SESSION_FUTURE_SKEW_MS past server time. Fires when the client sends a non-integer, zero/negative, or excessively future-skewed timestamp, rejecting clock-tampered or malformed session claims.","triggerScenarios":"Thrown at convex/payments/billing.ts:830 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Send sessionStartedAt as an integer millisecond epoch from Date.now() on the client","Ensure the client clock is reasonably synced; large future skew is rejected by design","Omit the field if no custom session start timestamp is needed"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9361220cc013571781071f0206e4d80fd14b2f7f","analyzedAt":"2026-08-21T16:51:25.751Z","contentChangedAt":"2026-08-21T16:51:25.751Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}