{"record":{"id":"8c5f0fbeb5a44691","repo":"koala73/worldmonitor","slug":"pushbatchaction-resend-api-key-not-set","errorCode":null,"errorMessage":"[pushBatchAction] RESEND_API_KEY not set","messagePattern":"\\[pushBatchAction\\] RESEND_API_KEY not set","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"convex/broadcast/waveRuns.ts","lineNumber":1136,"sourceCode":"            error: `failure rate ${(failureRate * 100).toFixed(2)}% exceeds ${(FAILURE_RATE_THRESHOLD * 100).toFixed(0)}% threshold`,\n          }\n        : {}),\n    });\n    return { ok: true as const, runFailed: exceeded };\n  },\n});\n\nexport const pushBatchAction = internalAction({\n  args: {\n    runId: v.string(),\n    batchN: v.number(),\n  },\n  handler: async (\n    ctx,\n    { runId, batchN },\n  ): Promise<{ ok: boolean; reason?: string }> => {\n    const apiKey = process.env.RESEND_API_KEY;\n    if (!apiKey) throw new Error(\"[pushBatchAction] RESEND_API_KEY not set\");\n\n    // Lease + state revalidation.\n    const info = await ctx.runQuery(\n      internal.broadcast.waveRuns._resumeBatchInfo,\n      { runId },\n    );\n    if (!info) {\n      console.warn(`[pushBatchAction] runId=${runId} not found; exiting`);\n      return { ok: false, reason: \"no-run\" };\n    }\n    if (!info.configHoldsLease) {\n      console.warn(`[pushBatchAction] runId=${runId} lost lease; exiting`);\n      return { ok: false, reason: \"lost-lease\" };\n    }\n    const allowedStatuses: WaveRunStatus[] = [\"segment-created\", \"pushing\"];\n    if (!allowedStatuses.includes(info.run.status)) {\n      console.warn(\n        `[pushBatchAction] runId=${runId} status=${info.run.status} not pushable; exiting`,","sourceCodeStart":1118,"sourceCodeEnd":1154,"githubUrl":"https://github.com/koala73/worldmonitor/blob/eeab0a219fce0f02a00603b532dbae9041b934ac/convex/broadcast/waveRuns.ts#L1118-L1154","documentation":"Configuration gate at the top of pushBatchAction: process.env.RESEND_API_KEY is unset on the Convex deployment. The action pushes a contact batch to a Resend segment, so it fails fast before any lease or state revalidation.","triggerScenarios":"Thrown at convex/broadcast/waveRuns.ts:1136 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set RESEND_API_KEY in the Convex dashboard environment variables","Re-run the batch push after fixing the environment; batch state is resumable via the run's lease"],"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-14T00:17:10.932Z"}