ruvnet/ruflo · error · Error
bootstrap iterations must be >= 100
Error message
bootstrap iterations must be >= 100
What it means
Thrown by computePromotionStatistics() when the bootstrap iteration count is not an integer or is below 100. The paired bootstrap resamples heldOutDeltas `iterations` times to estimate the probability that the candidate beats baseline; fewer than 100 samples produces statistically meaningless quantiles. Default is 10,000.
Source
Thrown at v3/@claude-flow/cli/src/services/flywheel-receipt.ts:263
else return values[k];
}
return values[k] ?? 0;
}
export function computePromotionStatistics(input: {
baselineScore: number;
candidateScore: number;
heldOutDeltas: number[];
frozenAnchorRegression: number;
corpusHash: string;
candidateId: string;
baselineRef: string;
evaluationRunId: string;
iterations?: number;
metricEpsilon?: number;
}): PromotionStatistics {
const iterations = input.iterations ?? 10_000;
if (!Number.isInteger(iterations) || iterations < 100) throw new Error('bootstrap iterations must be >= 100');
const n = input.heldOutDeltas.length;
const metricEpsilon = input.metricEpsilon ?? 1e-12;
const relativeLift = (input.candidateScore - input.baselineScore) / Math.max(Math.abs(input.baselineScore), metricEpsilon);
const seeded = seedFrom([
'ruflo/bootstrap/v1',
input.corpusHash,
input.candidateId,
input.baselineRef,
input.evaluationRunId,
]);
let state = seeded.seed >>> 0;
const rnd = () => {
state = (1664525 * state + 1013904223) >>> 0;
return state / 4294967296;
};
const means = new Array<number>(iterations);
let positiveMeans = 0;
if (n === 0) {View on GitHub (pinned to 6b01dc5a68)
Solutions
- Omit bootstrapIterations entirely to use the 10,000 default.
- Pass an integer >= 100 (e.g. 1000 for faster tests, 10000 for production).
- Validate the value with Number.isInteger(x) && x >= 100 before passing.
Example fix
// before
createFlywheelReceipt({ /* ... */, bootstrapIterations: 50 });
// after
createFlywheelReceipt({ /* ... */, bootstrapIterations: 1000 }); // or omit for default 10000 Defensive patterns
Strategy: validation
Validate before calling
const iterations = input.bootstrapIterations ?? 10_000;
if (!Number.isInteger(iterations) || iterations < 100) {
throw new Error(`bootstrapIterations must be an integer >= 100, got ${iterations}`);
} Type guard
const isValidIterationCount = (x: unknown): x is number => typeof x === 'number' && Number.isInteger(x) && x >= 100;
Prevention
- Omit bootstrapIterations in production to use the 10,000 default.
- For faster test runs use 1000, never below 100.
- Validate config values at load time rather than at receipt creation.
When it happens
Trigger: Calling createFlywheelReceipt({ bootstrapIterations: 50 }) or computePromotionStatistics({ iterations: 50 }), or passing a non-integer like 1000.5. The value flows from CreateReceiptInput.bootstrapIterations.
Common situations: A test/debug override set too low to speed up runs; a config typo; a fractional value from a division-based default.
Related errors
- metric must be finite
- undefined array member at ${path}[${i}]
- undefined property at ${path}.${key}
- unsupported JSON value at ${path}
- both Ed25519 private and public PEM keys are required
AI-assisted analysis of ruvnet/ruflo@6b01dc5a68 (2026-08-12).
Data as JSON: /api/errors/bf04c94b1aaa4d2f.
Report an issue: GitHub.