{"record":{"id":"506b56de958da729","repo":"koala73/worldmonitor","slug":"pushbatchaction-runid-runid-has-no-segmentid","errorCode":null,"errorMessage":"[pushBatchAction] runId=${runId} has no segmentId","messagePattern":"\\[pushBatchAction\\] runId=(.+?) has no segmentId","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"convex/broadcast/waveRuns.ts","lineNumber":1159,"sourceCode":"      { 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`,\n      );\n      return { ok: false, reason: `wrong-status-${info.run.status}` };\n    }\n    if (!info.run.segmentId) {\n      throw new Error(`[pushBatchAction] runId=${runId} has no segmentId`);\n    }\n\n    // First-batch transition picking → pushing (idempotent).\n    if (info.run.status === \"segment-created\") {\n      await ctx.runMutation(\n        internal.broadcast.waveRuns._markPushingStarted,\n        { runId },\n      );\n    }\n\n    // Pull this batch's pending contacts.\n    const batch = await ctx.runQuery(\n      internal.broadcast.waveRuns._getPendingBatch,\n      { runId, limit: info.run.batchSize },\n    );\n    if (batch.length === 0) {\n      // Nothing pending — schedule finalize.\n      await ctx.scheduler.runAfter(","sourceCodeStart":1141,"sourceCodeEnd":1177,"githubUrl":"https://github.com/koala73/worldmonitor/blob/eeab0a219fce0f02a00603b532dbae9041b934ac/convex/broadcast/waveRuns.ts#L1141-L1177","documentation":"State guard in pushBatchAction: the waveRuns row for runId exists and holds the lease, but has no segmentId recorded. Batch pushes target the Resend segment created during the pick phase, so a missing segmentId means the run never completed segment creation and there is nothing to push to.","triggerScenarios":"Thrown at convex/broadcast/waveRuns.ts:1159 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the run's status — if picking never completed, re-run the pick phase to create and record the segment","If the segmentId was lost, create the Resend segment manually and recover the run via the documented recovery flow before pushing"],"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"}