ruvnet/ruflo · error · RangeError
lambda must be in (0, 1)
Error message
lambda must be in (0, 1)
What it means
RangeError guard on lambda, the per-win betting fraction in the anytime-valid e-value product. The e-process only converges when lambda is strictly between 0 and 1, so values at or outside those bounds are rejected before any pairs are folded.
Solutions
- Choose lambda strictly between 0 and 1, e.g. 0.5
Example fix
Set lambda to a value strictly between 0 and 1 (e.g. 0.5).
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at v3/@claude-flow/cli/src/services/flywheel-sequential-evidence.ts:97 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of ruvnet/ruflo@fa13ee4ad6 (2026-08-18).
Data as JSON: /api/errors/76096b4f024ba6d9.
Report an issue: GitHub.
Appendix: source
Thrown at v3/@claude-flow/cli/src/services/flywheel-sequential-evidence.ts:97
if (!Number.isInteger(testIndex) || testIndex < 1) throw new RangeError('testIndex must be a positive integer');
if (!(alphaTotal > 0 && alphaTotal < 1)) throw new RangeError('alphaTotal must be in (0, 1)');
return (alphaTotal * 6) / (Math.PI * Math.PI * testIndex * testIndex);
}
/**
* Fold paired outcomes into an anytime-valid e-value and judge it against the
* k-th test's allocated alpha. Deterministic; order of outcomes does not
* change the final e-value (the product commutes).
*/
export function sequentialEvidenceVerdict(
outcomes: PairedTaskOutcome[],
testIndex: number,
config: SequentialEvidenceConfig = {},
): SequentialEvidenceVerdict {
const alphaTotal = config.alphaTotal ?? DEFAULT_ALPHA_TOTAL;
const lambda = config.lambda ?? DEFAULT_LAMBDA;
const epsilon = config.epsilon ?? DEFAULT_SCORE_EPSILON;
if (!(lambda > 0 && lambda < 1)) throw new RangeError('lambda must be in (0, 1)');
const alphaAllocated = alphaForTest(testIndex, alphaTotal);
const threshold = 1 / alphaAllocated;
let eValue = 1;
let informativePairs = 0;
for (const o of outcomes) {
const delta = o.candidateScore - o.baselineScore;
if (Math.abs(delta) <= epsilon) continue; // concordant: no information
informativePairs++;
// Under the null a discordant pair favors either arm with probability 1/2,
// so E[multiplier] = 1 and the running product is a martingale.
eValue *= delta > 0 ? 1 + lambda : 1 - lambda;
}
return {
significant: eValue >= threshold,
eValue,
threshold,View on GitHub (pinned to fa13ee4ad6)