ruvnet/ruflo · error
minSamples must be an integer in [1,1000]
Error message
minSamples must be an integer in [1,1000]
What it means
Config validation in normalizeApscConfig: minSamples sets how many observations an agent needs before its APSC score is trusted enough to act on, so it must be an integer in [1,1000]. Values outside that range would either act on noise (0) or never act.
Source
Thrown at v3/@claude-flow/cli/src/services/pheromone-adaptive.ts:104
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]');
}
const protectedRoles = [...new Set(
(input.protectedRoles ?? DEFAULT_APSC_CONFIG.protectedRoles)
.map((role) => role.trim().toLowerCase())
.filter(Boolean),
)].sort();
return {
alpha: alpha / weight,
beta: beta / weight,
gamma: gamma / weight,
emaDecay: unit(input.emaDecay ?? DEFAULT_APSC_CONFIG.emaDecay, 'emaDecay'),
pruningFactor: unit(input.pruningFactor ?? DEFAULT_APSC_CONFIG.pruningFactor, 'pruningFactor'),
reactivationThreshold: unit(
input.reactivationThreshold ?? DEFAULT_APSC_CONFIG.reactivationThreshold,
'reactivationThreshold',
),
minActiveAgents,
minSamples,View on GitHub (pinned to fa13ee4ad6)
Solutions
- Set minSamples to an integer between 1 and 1000 inclusive
Example fix
Set minSamples to an integer between 1 and 1000.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at v3/@claude-flow/cli/src/services/pheromone-adaptive.ts:104 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/5d5c4bb2c430ad3d.
Report an issue: GitHub.