koala73/worldmonitor · error · Error

[_recordPoolFilterStats] no run

Error message

[_recordPoolFilterStats] no run ${args.runId}

What it means

Internal invariant guard in _recordPoolFilterStats: no waveRuns row exists for the supplied runId. Per the docstring this is a caller logic bug (the action lost or never persisted its run row), not a normal recovery scenario — pool-filter statistics have nowhere to be recorded.

Solutions

  1. Trace the calling pickWaveAction run to see why its waveRuns row disappeared (deleted, or a mismatched runId)
  2. Fix the caller to pass the runId returned by the lease claim that inserted the row
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at convex/broadcast/waveRuns.ts:466 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/5643b86c7f3a237b. Report an issue: GitHub.

Appendix: source

Thrown at convex/broadcast/waveRuns.ts:481

 * them for THIS run's pool selection remains useful even if the lease has
 * since rotated. Throws only if the run row itself is missing (a logic
 * bug in the caller, not a normal recovery scenario).
 */
export const _recordPoolFilterStats = internalMutation({
  args: {
    runId: v.string(),
    excludeNonEnglish: v.boolean(),
    eligiblePoolCount: v.number(),
    excludedCount: v.number(),
    excludedLocaleCounts: v.record(v.string(), v.number()),
  },
  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(`[_recordPoolFilterStats] no run ${args.runId}`);
    }
    await ctx.db.patch(run._id, {
      excludeNonEnglish: args.excludeNonEnglish,
      eligiblePoolCount: args.eligiblePoolCount,
      excludedCount: args.excludedCount,
      excludedLocaleCounts: args.excludedLocaleCounts,
      updatedAt: Date.now(),
    });
    return { ok: true as const };
  },
});

// ───────────────────────────────────────────────────────────────────────────
// Pick phase
// ───────────────────────────────────────────────────────────────────────────

/**
 * Acquire the wave-run lease atomically. Refuses if:

View on GitHub (pinned to 7d06c8633d)