koala73/worldmonitor · error · Error

[_markPickComplete] no run

Error message

[_markPickComplete] no run ${args.runId}

What it means

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.

Solutions

  1. Verify the runId passed by pickWaveAction matches the one from the lease claim
  2. Investigate whether the waveRuns row was deleted externally while the pick was in flight
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at convex/broadcast/waveRuns.ts:602 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of koala73/worldmonitor@7d06c8633d (2026-08-21). Data as JSON: /api/errors/16a2cf93adbb2493. Report an issue: GitHub.

Appendix: source

Thrown at convex/broadcast/waveRuns.ts:618

});

/**
 * Transition a `picking`-status run to `segment-created` after pickWaveAction
 * has finished sampling, persisting, and creating the Resend segment.
 */
export const _markPickComplete = internalMutation({
  args: {
    runId: v.string(),
    segmentId: v.string(),
    totalCount: v.number(),
    underfilled: v.boolean(),
  },
  handler: async (ctx, args) => {
    const run = await ctx.db
      .query("waveRuns")
      .withIndex("by_runId", (q) => q.eq("runId", args.runId))
      .unique();
    if (!run) throw new Error(`[_markPickComplete] no run ${args.runId}`);
    if (run.status !== "picking") {
      throw new Error(
        `[_markPickComplete] run ${args.runId} is ${run.status}, expected picking`,
      );
    }
    const now = Date.now();
    await ctx.db.patch(run._id, {
      status: "segment-created",
      segmentId: args.segmentId,
      totalCount: args.totalCount,
      underfilled: args.underfilled,
      updatedAt: now,
    });
    return { ok: true };
  },
});

/**

View on GitHub (pinned to 7d06c8633d)