ruvnet/ruflo · error
${field} must be a finite number in [0,1]
Error message
${field} must be a finite number in [0,1] What it means
Generic unit-interval guard used by normalizeApscConfig for the APSC scoring weights (alpha, beta, gamma) and related scalars: the named value must be a finite number within [0,1]. Fires when the config contains NaN, Infinity, or a weight outside the unit interval; the field name in the message identifies which input failed.
Source
Thrown at v3/@claude-flow/cli/src/services/pheromone-adaptive.ts:87
export const DEFAULT_APSC_CONFIG: ApscConfig = {
alpha: 0.5,
beta: 0.2,
gamma: 0.3,
emaDecay: 0.85,
pruningFactor: 0.6,
reactivationThreshold: 0.75,
minActiveAgents: 3,
minSamples: 3,
maxSuspendFraction: 0.25,
explorationRate: 0.1,
dryRun: true,
protectedRoles: ['coordinator', 'queen', 'security-architect', 'security-auditor'],
};
const unit = (value: number, field: string): number => {
if (!Number.isFinite(value) || value < 0 || value > 1) {
throw new Error(`${field} must be a finite number in [0,1]`);
}
return value;
};
export function normalizeApscConfig(input: Partial<ApscConfig> = {}): ApscConfig {
const alpha = unit(input.alpha ?? DEFAULT_APSC_CONFIG.alpha, 'alpha');
const beta = unit(input.beta ?? DEFAULT_APSC_CONFIG.beta, 'beta');
const gamma = unit(input.gamma ?? DEFAULT_APSC_CONFIG.gamma, 'gamma');
const weight = alpha + beta + gamma;
if (weight <= 0) throw new Error('at least one APSC score weight must be positive');
const minActiveAgents = input.minActiveAgents ?? DEFAULT_APSC_CONFIG.minActiveAgents;
const minSamples = input.minSamples ?? DEFAULT_APSC_CONFIG.minSamples;
if (!Number.isInteger(minActiveAgents) || minActiveAgents < 1 || minActiveAgents > 50) {
throw new Error('minActiveAgents must be an integer in [1,50]');
}
if (!Number.isInteger(minSamples) || minSamples < 1 || minSamples > 1000) {
throw new Error('minSamples must be an integer in [1,1000]');
}View on GitHub (pinned to fa13ee4ad6)
Solutions
- Pass a finite number in the inclusive range [0,1] for the named field
Example fix
Set the named field to a finite number within [0,1].
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at v3/@claude-flow/cli/src/services/pheromone-adaptive.ts:87 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/f49d26bb015e698a.
Report an issue: GitHub.