n8n-io/n8n · error · Error
Invalid integer for ${flagName}
Error message
Invalid integer for ${flagName} What it means
Thrown by the parseIntArg() helper (args.ts:536) when parseInt(raw, 10) returns NaN for a flag that expects an integer. The raw value is intentionally not echoed in the message, because a bad shell expansion could leak a secret into the terminal/CI log. Affected flags: --timeout-ms, --iterations, --concurrency, --build-max-attempts, --build-mcp-timeout-ms, --build-timeout-ms.
Source
Thrown at packages/@n8n/instance-ai/evaluations/cli/args.ts:536
// ---------------------------------------------------------------------------
// Helpers
// ---------------------------------------------------------------------------
function nextArg(argv: string[], currentIndex: number, flagName: string): string {
const value = argv[currentIndex + 1];
if (value === undefined || value.startsWith('--')) {
throw new Error(`Missing value for ${flagName}`);
}
return value;
}
function parseIntArg(argv: string[], currentIndex: number, flagName: string): number {
const raw = nextArg(argv, currentIndex, flagName);
const parsed = parseInt(raw, 10);
if (Number.isNaN(parsed)) {
// Don't echo raw — a bad shell expansion could leak a secret here.
throw new Error(`Invalid integer for ${flagName}`);
}
return parsed;
}
View on GitHub (pinned to 5ac6606e81)
Solutions
- Provide a valid base-10 integer with no units or suffixes (e.g. 300000 for milliseconds).
- Verify any shell variables used for numeric flags are set: `echo "${ITERATIONS:?unset}"`.
- Check units: --timeout-ms and --build-timeout-ms are milliseconds, not seconds.
Example fix
// before pnpm eval:instance-ai --timeout-ms 30s // after pnpm eval:instance-ai --timeout-ms 30000
Defensive patterns
Strategy: validation
Validate before calling
const INT_FLAGS = new Set(['--timeout-ms','--iterations','--concurrency','--build-max-attempts','--build-mcp-timeout-ms','--build-timeout-ms']);
function validateIntFlags(args: string[]): void {
for (let i = 0; i < args.length; i++) {
if (INT_FLAGS.has(args[i].split('=',1)[0])) {
const v = args[i + 1];
if (v === undefined || !/^\d+$/.test(v)) {
throw new Error(`Invalid integer for ${args[i]}: ${v === undefined ? '(missing)' : v}`);
}
}
}
} Type guard
function isIntegerFlagValue(v: string): boolean {
return /^\d+$/.test(v);
} Prevention
- Never append units (s, ms) to integer flag values — use raw milliseconds.
- Verify shell variables for numeric flags are set and numeric: `${VAR:?}` plus a regex check.
- Remember --timeout-ms and --build-timeout-ms are milliseconds, not seconds.
When it happens
Trigger: Passing a non-numeric value (a word, a float with junk, an empty expansion, or a shell variable that resolved to nothing) to an integer flag. For example `--iterations abc`, `--concurrency $MISSING_VAR`, or `--timeout-ms 1e6` (exponential notation may fail depending on parseInt behavior). Note: parseInt('123abc') returns 123, so partial-numeric values may slip through; only fully non-numeric prefixes trip NaN.
Common situations: A shell variable for a numeric setting is unset or misspelled, a value was copy-pasted with a unit suffix (e.g. 30s instead of 30000ms), or a decimal was passed where an int was expected and the leading part was non-numeric.
Related errors
- Unknown flag: ${flagName}
- Unexpected positional argument
- Unknown flag: ${arg.split('=', 1)[0]} (use --help)
- --delete-prebuilt-workflows applies to --prebuilt-workflows.
- ${[...new Set(raw.buildOnlyFlags)].join(', ')} only take${ra
AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12).
Data as JSON: /api/errors/0d4e559356064f5c.
Report an issue: GitHub.