Egonex-AI/Understand-Anything · error · CliUsageError

--concurrency must be an integer between 1 and 32

Error message

--concurrency must be an integer between 1 and 32

What it means

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.

Source

Thrown at scripts/lib/large-repo-benchmark.mjs:252

      concurrency = parseConcurrency(arg.slice('--concurrency='.length));
      continue;
    }
    if (arg.startsWith('-')) {
      throw new CliUsageError(`Unknown option: ${arg}`);
    }
    if (repoValue) {
      throw new CliUsageError(`Unexpected positional argument: ${arg}`);
    }
    repoValue = arg;
  }

  if (help) return { help: true };
  if (!repoValue) throw new CliUsageError('A repository path is required');
  if (outputValue === null || outputValue.trim() === '') {
    throw new CliUsageError('--output is required and must be non-empty');
  }
  if (!Number.isInteger(concurrency) || concurrency < 1 || concurrency > 32) {
    throw new CliUsageError('--concurrency must be an integer between 1 and 32');
  }

  const repoRoot = resolve(cwd, repoValue);
  if (!existsSync(repoRoot)) {
    throw new CliUsageError(`Repository path does not exist: ${repoValue}`);
  }
  if (!statSync(repoRoot).isDirectory()) {
    throw new CliUsageError(`Repository path is not a directory: ${repoValue}`);
  }

  const outputPath = resolve(cwd, outputValue);
  const markdownPath = resolve(
    cwd,
    outputPath.toLowerCase().endsWith('.json')
      ? `${outputPath.slice(0, -'.json'.length)}.md`
      : `${outputPath}.md`,
  );
  if (isPathInsideOrEqual(repoRoot, outputPath)) {

View on GitHub (pinned to 32944829e7)

Solutions

  1. Pass an integer between 1 and 32 inclusive, e.g. --concurrency 8.
  2. Omit --concurrency to use the default of 5.
  3. 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.
  4. Run with --help to confirm the accepted range.

Example fix

# before
node benchmark-large-repo.mjs myrepo --output out.json --concurrency max
# after
node benchmark-large-repo.mjs myrepo --output out.json --concurrency 16
Defensive patterns

Strategy: validation

Validate before calling

function validConcurrency(v: string): boolean {
  return /^[0-9]+$/.test(v) && Number.isInteger(Number(v)) && Number(v) >= 1 && Number(v) <= 32;
}

Type guard

function isConcurrency(v: unknown): boolean {
  return typeof v === 'number' && Number.isInteger(v) && v >= 1 && v <= 32;
}

Try / catch

try { const opts = parseArgs(argv); } catch (e) { if ((e as Error).name === 'CliUsageError') { console.error(e.message); process.exit(2); } throw e; }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of Egonex-AI/Understand-Anything@32944829e7 (2026-08-12). Data as JSON: /api/errors/9c90db3eae0e7d32. Report an issue: GitHub.