{"record":{"id":"f49d26bb015e698a","repo":"ruvnet/ruflo","slug":"field-must-be-a-finite-number-in-0-1","errorCode":null,"errorMessage":"${field} must be a finite number in [0,1]","messagePattern":"(.+?) must be a finite number in \\[0,1\\]","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/cli/src/services/pheromone-adaptive.ts","lineNumber":87,"sourceCode":"\nexport const DEFAULT_APSC_CONFIG: ApscConfig = {\n  alpha: 0.5,\n  beta: 0.2,\n  gamma: 0.3,\n  emaDecay: 0.85,\n  pruningFactor: 0.6,\n  reactivationThreshold: 0.75,\n  minActiveAgents: 3,\n  minSamples: 3,\n  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  }","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/@claude-flow/cli/src/services/pheromone-adaptive.ts#L69-L105","documentation":"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.","triggerScenarios":"Thrown at v3/@claude-flow/cli/src/services/pheromone-adaptive.ts:87 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a finite number in the inclusive range [0,1] for the named field"],"exampleFix":"Set the named field to a finite number within [0,1].","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-14T05:17:10.506Z"}