{"record":{"id":"9c90db3eae0e7d32","repo":"Egonex-AI/Understand-Anything","slug":"concurrency-must-be-an-integer-between-1-and-32","errorCode":null,"errorMessage":"--concurrency must be an integer between 1 and 32","messagePattern":"--concurrency must be an integer between 1 and 32","errorType":"validation","errorClass":"CliUsageError","httpStatus":null,"severity":"error","filePath":"scripts/lib/large-repo-benchmark.mjs","lineNumber":252,"sourceCode":"      concurrency = parseConcurrency(arg.slice('--concurrency='.length));\n      continue;\n    }\n    if (arg.startsWith('-')) {\n      throw new CliUsageError(`Unknown option: ${arg}`);\n    }\n    if (repoValue) {\n      throw new CliUsageError(`Unexpected positional argument: ${arg}`);\n    }\n    repoValue = arg;\n  }\n\n  if (help) return { help: true };\n  if (!repoValue) throw new CliUsageError('A repository path is required');\n  if (outputValue === null || outputValue.trim() === '') {\n    throw new CliUsageError('--output is required and must be non-empty');\n  }\n  if (!Number.isInteger(concurrency) || concurrency < 1 || concurrency > 32) {\n    throw new CliUsageError('--concurrency must be an integer between 1 and 32');\n  }\n\n  const repoRoot = resolve(cwd, repoValue);\n  if (!existsSync(repoRoot)) {\n    throw new CliUsageError(`Repository path does not exist: ${repoValue}`);\n  }\n  if (!statSync(repoRoot).isDirectory()) {\n    throw new CliUsageError(`Repository path is not a directory: ${repoValue}`);\n  }\n\n  const outputPath = resolve(cwd, outputValue);\n  const markdownPath = resolve(\n    cwd,\n    outputPath.toLowerCase().endsWith('.json')\n      ? `${outputPath.slice(0, -'.json'.length)}.md`\n      : `${outputPath}.md`,\n  );\n  if (isPathInsideOrEqual(repoRoot, outputPath)) {","sourceCodeStart":234,"sourceCodeEnd":270,"githubUrl":"https://github.com/Egonex-AI/Understand-Anything/blob/32944829e7a63a9fa9c55d811d7f98a9530c6a6a/scripts/lib/large-repo-benchmark.mjs#L234-L270","documentation":"CliUsageError thrown by parseArgs when concurrency is not an integer in [1,32]. Concurrency defaults to 5; parseConcurrency returns NaN for any non-numeric value, and the range check rejects anything below 1 or above 32.","triggerScenarios":"Passing --concurrency with a non-numeric value (e.g. 'auto', 'max', '5.5'); a value of 0, negative, or above 32; an empty string; the '=' form with garbage after the equals sign.","commonSituations":"Trying to express concurrency as 'max' or 'all'; assuming the tool accepts fractional or unbounded concurrency; copy-pasting a value from another tool's documentation.","solutions":["Pass an integer between 1 and 32 inclusive, e.g. --concurrency 8.","Omit --concurrency to use the default of 5.","If you need more parallelism than 32, the cap is intentional — reduce the per-worker cost or split the run rather than raising the limit.","Run with --help to confirm the accepted range."],"exampleFix":"# before\nnode benchmark-large-repo.mjs myrepo --output out.json --concurrency max\n# after\nnode benchmark-large-repo.mjs myrepo --output out.json --concurrency 16","handlingStrategy":"validation","validationCode":"function validConcurrency(v: string): boolean {\n  return /^[0-9]+$/.test(v) && Number.isInteger(Number(v)) && Number(v) >= 1 && Number(v) <= 32;\n}","typeGuard":"function isConcurrency(v: unknown): boolean {\n  return typeof v === 'number' && Number.isInteger(v) && v >= 1 && v <= 32;\n}","tryCatchPattern":"try { const opts = parseArgs(argv); } catch (e) { if ((e as Error).name === 'CliUsageError') { console.error(e.message); process.exit(2); } throw e; }","preventionTips":["Pass an integer in [1,32]; omit --concurrency to use the default of 5.","Validate the value in wrappers before invoking the command."],"tags":["benchmark","cli","argument-parsing","concurrency"],"backgroundTag":null,"analyzedSha":"32944829e7a63a9fa9c55d811d7f98a9530c6a6a","analyzedAt":"2026-08-12T10:25:44.261Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}