n8n-io/n8n · error · Error

--concurrency must be >= 1

Error message

--concurrency must be >= 1

What it means

Thrown by parseArgs() (build-mcp-manifest.ts:231) when the parsed --concurrency value (or -j shorthand) is less than 1. Concurrency controls parallel build subprocesses; zero or negative concurrency is meaningless. Like --iterations, parseIntArg accepts 0/negatives, so this boundary check catches non-positive values after parsing.

Source

Thrown at packages/@n8n/instance-ai/evaluations/cli/build-mcp-manifest.ts:231

			case '--suite':
				result.suite = nextArg(argv, i, arg);
				i += 2;
				break;
			case '-h':
			case '--help':
				return { helpRequested: true };
			default:
				if (arg.startsWith('--')) {
					throw new Error(`Unknown flag: ${arg.split('=', 1)[0]} (use --help)`);
				}
				result.slugs.push(arg);
				i += 1;
				break;
		}
	}

	if (result.iterations < 1) throw new Error('--iterations must be >= 1');
	if (result.concurrency < 1) throw new Error('--concurrency must be >= 1');
	if (result.maxAttempts < 1) throw new Error('--max-attempts must be >= 1');
	if (result.source === 'langtracer' && !result.suite) {
		throw new Error('--source langtracer requires --suite <slug>');
	}

	mkdirSync(result.outputDir, { recursive: true });
	if (!result.manifestPath) result.manifestPath = join(result.outputDir, 'manifest.json');
	if (!result.logDir) result.logDir = join(result.outputDir, 'logs');
	const base = result.manifestPath.replace(/\.json$/, '');
	result.statsPath = `${base}-stats.json`;
	mkdirSync(result.logDir, { recursive: true });

	return { helpRequested: false, args: result };
}

function readJson(path: string, label: string): unknown {
	const content = readFileSync(path, 'utf-8');
	try {

View on GitHub (pinned to 5ac6606e81)

Solutions

  1. Pass a positive integer: --concurrency 1 or higher (default is 1).
  2. If computing concurrency dynamically, guard the value: `CONCURRENCY=$(( CORES > 0 ? CORES : 1 ))` before passing.
  3. Verify the shell variable is set and positive: `echo "${CONCURRENCY:?unset}"`.

Example fix

// before
pnpm eval:build-mcp-manifest --concurrency 0
// after
pnpm eval:build-mcp-manifest --concurrency 2
Defensive patterns

Strategy: validation

Validate before calling

function validateConcurrency(args: string[]): void {
  for (let i = 0; i < args.length; i++) {
    if ((args[i] === '-j' || args[i] === '--concurrency')) {
      const v = Number(args[i + 1]);
      if (!Number.isInteger(v) || v < 1) {
        throw new Error(`--concurrency must be >= 1, got: ${args[i + 1]}`);
      }
    }
  }
}

Type guard

function isPositiveInt(v: unknown): v is number {
  return typeof v === 'number' && Number.isInteger(v) && v >= 1;
}

Prevention

When it happens

Trigger: Passing `--concurrency 0`, `-j 0`, `--concurrency -1`, or a shell variable resolving to a non-positive integer. parseIntArg only rejects NaN.

Common situations: A shell variable for concurrency is unset and defaulted to 0, a script derives concurrency from CPU count and produces 0 on a constrained runner, or a typo passes a negative number.

Related errors


AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12). Data as JSON: /api/errors/e5ece1ac1203e9af. Report an issue: GitHub.