koala73/worldmonitor · error · Error
[pickWaveAction] requestedCount must be a positive integer…
Error message
[pickWaveAction] requestedCount must be a positive integer; got ${args.requestedCount} What it means
Argument validation in pickWaveAction: requestedCount is not a positive integer (zero, negative, fractional, or NaN). The requested wave size drives sampling and Resend segment creation, so an invalid count is rejected before any state is touched.
Solutions
- Pass a positive integer requestedCount matching the ramp tier's wave size
- Validate the count at the caller (ramp runner config) before dispatching the action
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at convex/broadcast/waveRuns.ts:701 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of koala73/worldmonitor@eeab0a219f (2026-08-21).
Data as JSON: /api/errors/da8d0db6904e04a0.
Report an issue: GitHub.
Appendix: source
Thrown at convex/broadcast/waveRuns.ts:701
args: {
waveLabel: v.string(),
runId: v.string(),
requestedCount: v.number(),
batchSize: v.optional(v.number()),
// Filter contacts whose locale (from `users.localePrimary` or email-TLD
// heuristic fallback) is non-English. Filter runs INSIDE the registration
// pagination loop, BEFORE reservoir sampling — sampling-then-filtering
// would silently underfill (sample 1000, exclude 200, send 800 even
// though thousands of eligible English contacts existed elsewhere).
excludeNonEnglish: v.optional(v.boolean()),
},
handler: async (ctx, args): Promise<{ ok: boolean; reason?: string }> => {
const apiKey = process.env.RESEND_API_KEY;
if (!apiKey) {
throw new Error("[pickWaveAction] RESEND_API_KEY not set");
}
if (!Number.isFinite(args.requestedCount) || args.requestedCount <= 0) {
throw new Error(
`[pickWaveAction] requestedCount must be a positive integer; got ${args.requestedCount}`,
);
}
if (args.waveLabel.length === 0 || args.waveLabel.length > 64) {
throw new Error("[pickWaveAction] waveLabel must be 1-64 chars");
}
const batchSize = args.batchSize ?? DEFAULT_BATCH_SIZE;
const excludeNonEnglish = args.excludeNonEnglish === true;
// Step 1: claim lease + insert waveRuns row.
const claim: ClaimLeaseResult = await ctx.runMutation(
internal.broadcast.waveRuns._claimWaveRunLease,
{
waveLabel: args.waveLabel,
runId: args.runId,
requestedCount: args.requestedCount,
batchSize,
},View on GitHub (pinned to eeab0a219f)