{"record":{"id":"710e8c28233a3a40","repo":"ruvnet/ruflo","slug":"minactiveagents-must-be-an-integer-in-1-50","errorCode":null,"errorMessage":"minActiveAgents must be an integer in [1,50]","messagePattern":"minActiveAgents must be an integer in \\[1,50\\]","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/cli/src/services/pheromone-adaptive.ts","lineNumber":101,"sourceCode":"};\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'),\n    pruningFactor: unit(input.pruningFactor ?? DEFAULT_APSC_CONFIG.pruningFactor, 'pruningFactor'),\n    reactivationThreshold: unit(\n      input.reactivationThreshold ?? DEFAULT_APSC_CONFIG.reactivationThreshold,\n      'reactivationThreshold',","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/@claude-flow/cli/src/services/pheromone-adaptive.ts#L83-L119","documentation":"Config validation in normalizeApscConfig: minActiveAgents bounds how many agents must stay active (suspension is refused below it), so it must be an integer between 1 and 50 — zero would allow suspending everyone, and large values would make the floor meaningless.","triggerScenarios":"Thrown at v3/@claude-flow/cli/src/services/pheromone-adaptive.ts:101 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set minActiveAgents to an integer between 1 and 50 inclusive"],"exampleFix":"Set minActiveAgents to an integer between 1 and 50.","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"}