{"record":{"id":"19cb6f9934e95112","repo":"ruvnet/ruflo","slug":"at-least-one-apsc-score-weight-must-be-positive","errorCode":null,"errorMessage":"at least one APSC score weight must be positive","messagePattern":"at least one APSC score weight must be positive","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/cli/src/services/pheromone-adaptive.ts","lineNumber":97,"sourceCode":"  maxSuspendFraction: 0.25,\n  explorationRate: 0.1,\n  dryRun: true,\n  protectedRoles: ['coordinator', 'queen', 'security-architect', 'security-auditor'],\n};\n\nconst unit = (value: number, field: string): number => {\n  if (!Number.isFinite(value) || value < 0 || value > 1) {\n    throw new Error(`${field} must be a finite number in [0,1]`);\n  }\n  return value;\n};\n\nexport function normalizeApscConfig(input: Partial<ApscConfig> = {}): ApscConfig {\n  const alpha = unit(input.alpha ?? DEFAULT_APSC_CONFIG.alpha, 'alpha');\n  const beta = unit(input.beta ?? DEFAULT_APSC_CONFIG.beta, 'beta');\n  const gamma = unit(input.gamma ?? DEFAULT_APSC_CONFIG.gamma, 'gamma');\n  const weight = alpha + beta + gamma;\n  if (weight <= 0) throw new Error('at least one APSC score weight must be positive');\n  const minActiveAgents = input.minActiveAgents ?? DEFAULT_APSC_CONFIG.minActiveAgents;\n  const minSamples = input.minSamples ?? DEFAULT_APSC_CONFIG.minSamples;\n  if (!Number.isInteger(minActiveAgents) || minActiveAgents < 1 || minActiveAgents > 50) {\n    throw new Error('minActiveAgents must be an integer in [1,50]');\n  }\n  if (!Number.isInteger(minSamples) || minSamples < 1 || minSamples > 1000) {\n    throw new Error('minSamples must be an integer in [1,1000]');\n  }\n  const protectedRoles = [...new Set(\n    (input.protectedRoles ?? DEFAULT_APSC_CONFIG.protectedRoles)\n      .map((role) => role.trim().toLowerCase())\n      .filter(Boolean),\n  )].sort();\n  return {\n    alpha: alpha / weight,\n    beta: beta / weight,\n    gamma: gamma / weight,\n    emaDecay: unit(input.emaDecay ?? DEFAULT_APSC_CONFIG.emaDecay, 'emaDecay'),","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/@claude-flow/cli/src/services/pheromone-adaptive.ts#L79-L115","documentation":"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.","triggerScenarios":"Thrown at v3/@claude-flow/cli/src/services/pheromone-adaptive.ts:97 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set at least one APSC score weight to a positive value"],"exampleFix":"Give at least one APSC score weight a positive value in the adaptive configuration.","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fa13ee4ad60ac2090b1480656eb233521790d640","analyzedAt":"2026-08-18T21:34:22.708Z","contentChangedAt":"2026-08-18T21:34:22.708Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}