{"record":{"id":"e316ed16f36cfa3f","repo":"koala73/worldmonitor","slug":"recordpendingexport-lease-lost-expected-runid","errorCode":null,"errorMessage":"[_recordPendingExport] lease lost: expected runId=${args.runId}, found ${row.pendingRunId ?? \"<cleared>\"}. Refusing to persist export progress — operator/another run owns the state.","messagePattern":"\\[_recordPendingExport\\] lease lost: expected runId=(.+?), found (.+?)\\. Refusing to persist export progress — operator/another run owns the state\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"convex/broadcast/rampRunner.ts","lineNumber":722,"sourceCode":" * metadata if the action dies between this point and a successful\n * `_recordWaveSent`.\n *\n * Lease-validating: throws if the lease has changed (operator\n * `forceReleaseLease` mid-flight, or a different run claimed). The throw\n * bubbles to Convex auto-Sentry; the runner stops without advancing.\n */\nexport const _recordPendingExport = internalMutation({\n  args: {\n    runId: v.string(),\n    waveLabel: v.string(),\n    segmentId: v.string(),\n    assigned: v.number(),\n  },\n  handler: async (ctx, args) => {\n    const row = await loadConfig(ctx);\n    if (!row) throw new Error(\"[_recordPendingExport] no ramp configured\");\n    if (row.pendingRunId !== args.runId) {\n      throw new Error(\n        `[_recordPendingExport] lease lost: expected runId=${args.runId}, found ${row.pendingRunId ?? \"<cleared>\"}. Refusing to persist export progress — operator/another run owns the state.`,\n      );\n    }\n    await ctx.db.patch(row._id, {\n      pendingWaveLabel: args.waveLabel,\n      pendingSegmentId: args.segmentId,\n      pendingAssigned: args.assigned,\n      pendingExportAt: Date.now(),\n    });\n    return { ok: true as const };\n  },\n});\n\n/**\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","sourceCodeStart":704,"sourceCodeEnd":740,"githubUrl":"https://github.com/koala73/worldmonitor/blob/7d06c8633d256c18e38133030bc3613976a96ec9/convex/broadcast/rampRunner.ts#L704-L740","documentation":"Error \"[_recordPendingExport] lease lost: expected runId=${args.runId}, found ${row.pendingRunId ?? \"<cleared>\"}. Refusing to persist export progress — operator/another run owns the state.\" thrown in koala73/worldmonitor.","triggerScenarios":"Thrown at convex/broadcast/rampRunner.ts:720 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Identify what cleared or replaced the lease (forceReleaseLease call, another run claiming) from Convex logs before touching state","Do not retry the export — re-running could double-send the wave; use recoverFromPartialFailure against any persisted progress instead","If operator intervention was intentional, let the owning run proceed and abandon this one"],"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"}