{"record":{"id":"e28790e95500eb28","repo":"koala73/worldmonitor","slug":"recordpendingbroadcast-lease-lost-expected-run","errorCode":null,"errorMessage":"[_recordPendingBroadcast] lease lost: expected runId=${args.runId}, found ${row.pendingRunId ?? \"<cleared>\"}. Refusing to persist broadcast progress — operator/another run owns the state.","messagePattern":"\\[_recordPendingBroadcast\\] lease lost: expected runId=(.+?), found (.+?)\\. Refusing to persist broadcast progress — operator/another run owns the state\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"convex/broadcast/rampRunner.ts","lineNumber":754,"sourceCode":"/**\n * Persist post-`createProLaunchBroadcast` progress. Called by the runner\n * AFTER `createProLaunchBroadcast` returns successfully. Lets\n * `recoverFromPartialFailure` recover the broadcastId without\n * operator-supplied metadata if the action dies between this point and a\n * successful `_recordWaveSent`.\n *\n * Lease-validating: same semantics as `_recordPendingExport`.\n */\nexport const _recordPendingBroadcast = internalMutation({\n  args: {\n    runId: v.string(),\n    broadcastId: v.string(),\n  },\n  handler: async (ctx, args) => {\n    const row = await loadConfig(ctx);\n    if (!row) throw new Error(\"[_recordPendingBroadcast] no ramp configured\");\n    if (row.pendingRunId !== args.runId) {\n      throw new Error(\n        `[_recordPendingBroadcast] lease lost: expected runId=${args.runId}, found ${row.pendingRunId ?? \"<cleared>\"}. Refusing to persist broadcast progress — operator/another run owns the state.`,\n      );\n    }\n    await ctx.db.patch(row._id, {\n      pendingBroadcastId: args.broadcastId,\n      pendingBroadcastAt: Date.now(),\n    });\n    return { ok: true as const };\n  },\n});\n\n/**\n * Internal mutation that the action calls to atomically advance the tier +\n * record a successful wave-send. Validates that the lease still belongs to\n * this runId AND clears all pending-progress markers.\n */\nexport const _recordWaveSent = internalMutation({\n  args: {","sourceCodeStart":736,"sourceCodeEnd":772,"githubUrl":"https://github.com/koala73/worldmonitor/blob/7d06c8633d256c18e38133030bc3613976a96ec9/convex/broadcast/rampRunner.ts#L736-L772","documentation":"Error \"[_recordPendingBroadcast] lease lost: expected runId=${args.runId}, found ${row.pendingRunId ?? \"<cleared>\"}. Refusing to persist broadcast progress — operator/another run owns the state.\" thrown in koala73/worldmonitor.","triggerScenarios":"Thrown at convex/broadcast/rampRunner.ts:752 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Identify the new lease owner (operator forceReleaseLease or a competing run) from Convex logs before acting","Do not blindly retry — the broadcast was already created in Resend; recover via recoverFromPartialFailure with the known broadcastId instead of creating a duplicate"],"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"}