n8n-io/n8n · error · Error
Invalid integer for ${flag}
Error message
Invalid integer for ${flag} What it means
The parseIntArg helper (line 265) calls nextArg to get the raw value, then parseInt(raw, 10). If the result is NaN, the value was not a valid base-10 integer and the error identifies which flag received the bad value. This catches non-numeric input before it silently becomes NaN in downstream iteration/concurrency/maxAttempts arithmetic.
Source
Thrown at packages/@n8n/instance-ai/evaluations/cli/build-mcp-manifest.ts:268
return JSON.parse(content);
} catch (error) {
const msg = error instanceof Error ? error.message : String(error);
throw new Error(`Failed to parse ${label} at ${path}: ${msg}`);
}
}
function nextArg(argv: string[], i: number, flag: string): string {
const value = argv[i + 1];
if (value === undefined || value.startsWith('--')) {
throw new Error(`Missing value for ${flag}`);
}
return value;
}
function parseIntArg(argv: string[], i: number, flag: string): number {
const raw = nextArg(argv, i, flag);
const parsed = parseInt(raw, 10);
if (Number.isNaN(parsed)) throw new Error(`Invalid integer for ${flag}`);
return parsed;
}
// ---------------------------------------------------------------------------
// Build outcome + test-case prompt source
//
// The `claude -p` invocation, MCP config staging, prompt flattening, and
// workflow-id extraction live in ./mcp-builder (shared with the fused
// --build-via-mcp eval path). This file owns only the manifest/stats concerns.
// ---------------------------------------------------------------------------
interface BuildOutcome {
slug: string;
iteration: number;
workflowId: string | null;
cost: number;
turns: number;
durationMs: number;View on GitHub (pinned to 5ac6606e81)
Solutions
- Provide a valid whole number for the flag (e.g. --iterations 3)
- Verify no accidental spaces or quotes around the value
- Check that the value is numeric, not a word or empty string
Example fix
# before pnpm eval:build-mcp-manifest --iterations three # after pnpm eval:build-mcp-manifest --iterations 3
Defensive patterns
Strategy: validation
Validate before calling
// Validate integer values in wrapper scripts before passing to the CLI:
function parseIntOrThrow(raw: string, flag: string): number {
const n = Number.parseInt(raw, 10);
if (Number.isNaN(n)) throw new Error(`Invalid integer for ${flag}: ${raw}`);
return n;
} Type guard
function isIntegerString(v: string): boolean {
return /^-?\d+$/.test(v.trim());
} Prevention
- Pass only whole numbers (3, not 'three' or 3.5) to integer flags
- Validate numeric args in wrapper scripts before forwarding to the CLI
When it happens
Trigger: Running `pnpm eval:build-mcp-manifest --iterations abc`, `--concurrency x`, or any integer flag with a non-numeric token. Note: parseInt('1.5') returns 1 (not NaN), so floats with integer prefixes are accepted; only fully non-numeric values trigger this.
Common situations: Typo in a numeric argument (e.g. spelling out 'three' instead of 3). Copy-paste error. A variable expansion that produced an empty string or non-numeric value.
Related errors
- --max-attempts must be >= 1
- Missing value for ${flag}
- --source langtracer requires --suite <slug>
- Workflow directory not found: ${workflowDir}
- --build-cwd directory does not exist: ${args.buildCwd}
AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12).
Data as JSON: /api/errors/1de2acaec2db7169.
Report an issue: GitHub.