ruvnet/ruflo · error

at least one APSC score weight must be positive

Error message

at least one APSC score weight must be positive

What it means

The three APSC score weights (alpha + beta + gamma) all summed to zero, so no scoring channel would contribute and adaptive suspension decisions would be undefined. normalizeApscConfig rejects an all-zero weighting rather than running with a degenerate score.

Source

Thrown at v3/@claude-flow/cli/src/services/pheromone-adaptive.ts:97

  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]');
  }
  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'),

View on GitHub (pinned to fa13ee4ad6)

Solutions

  1. Set at least one APSC score weight to a positive value

Example fix

Give at least one APSC score weight a positive value in the adaptive configuration.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at v3/@claude-flow/cli/src/services/pheromone-adaptive.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/19cb6f9934e95112. Report an issue: GitHub.