{"record":{"id":"16a2cf93adbb2493","repo":"koala73/worldmonitor","slug":"markpickcomplete-no-run-args-runid","errorCode":null,"errorMessage":"[_markPickComplete] no run ${args.runId}","messagePattern":"\\[_markPickComplete\\] no run (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"convex/broadcast/waveRuns.ts","lineNumber":618,"sourceCode":"});\n\n/**\n * Transition a `picking`-status run to `segment-created` after pickWaveAction\n * has finished sampling, persisting, and creating the Resend segment.\n */\nexport const _markPickComplete = internalMutation({\n  args: {\n    runId: v.string(),\n    segmentId: v.string(),\n    totalCount: v.number(),\n    underfilled: v.boolean(),\n  },\n  handler: async (ctx, args) => {\n    const run = await ctx.db\n      .query(\"waveRuns\")\n      .withIndex(\"by_runId\", (q) => q.eq(\"runId\", args.runId))\n      .unique();\n    if (!run) throw new Error(`[_markPickComplete] no run ${args.runId}`);\n    if (run.status !== \"picking\") {\n      throw new Error(\n        `[_markPickComplete] run ${args.runId} is ${run.status}, expected picking`,\n      );\n    }\n    const now = Date.now();\n    await ctx.db.patch(run._id, {\n      status: \"segment-created\",\n      segmentId: args.segmentId,\n      totalCount: args.totalCount,\n      underfilled: args.underfilled,\n      updatedAt: now,\n    });\n    return { ok: true };\n  },\n});\n\n/**","sourceCodeStart":600,"sourceCodeEnd":636,"githubUrl":"https://github.com/koala73/worldmonitor/blob/7d06c8633d256c18e38133030bc3613976a96ec9/convex/broadcast/waveRuns.ts#L600-L636","documentation":"Internal invariant guard in _markPickComplete: no waveRuns row exists for the supplied runId. The pick-completion transition (picking → segment-created) cannot proceed because the run record is missing — a caller logic bug or the run row was deleted mid-flight.","triggerScenarios":"Thrown at convex/broadcast/waveRuns.ts:602 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the runId passed by pickWaveAction matches the one from the lease claim","Investigate whether the waveRuns row was deleted externally while the pick was in flight"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7d06c8633d256c18e38133030bc3613976a96ec9","analyzedAt":"2026-08-21T16:51:25.751Z","contentChangedAt":"2026-08-21T16:51:25.751Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}