n8n-io/n8n · error · Error
Missing value for ${flag}
Error message
Missing value for ${flag} What it means
The nextArg helper (line 257) fetches the token immediately following a flag in argv. It throws when the next token is undefined (the flag is the last argument) or starts with '--' (the next token looks like another flag, not a value). This prevents flags from being silently consumed as values for other flags.
Source
Thrown at packages/@n8n/instance-ai/evaluations/cli/build-mcp-manifest.ts:260
mkdirSync(result.logDir, { recursive: true });
return { helpRequested: false, args: result };
}
function readJson(path: string, label: string): unknown {
const content = readFileSync(path, 'utf-8');
try {
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.
// ---------------------------------------------------------------------------View on GitHub (pinned to 5ac6606e81)
Solutions
- Provide the value immediately after the flag: --model claude-sonnet-4-6
- Check that the intended value does not start with --
- Re-examine the full command for missing or misplaced tokens
Example fix
# before pnpm eval:build-mcp-manifest --model # after pnpm eval:build-mcp-manifest --model claude-sonnet-4-6
Defensive patterns
Strategy: validation
Validate before calling
// Validate that every value-taking flag has a non-flag value in argv:
function validateFlagValues(argv: string[], valueFlags: string[]): void {
for (let i = 0; i < argv.length; i++) {
if (valueFlags.includes(argv[i])) {
const next = argv[i + 1];
if (next === undefined || next.startsWith('--')) {
throw new Error(`Missing value for ${argv[i]}`);
}
}
}
} Prevention
- Always provide a value immediately after each value-taking flag
- Double-check that values do not start with '--'
- Review the full command line before pressing enter
When it happens
Trigger: Running `pnpm eval:build-mcp-manifest --model` with nothing after it, or `--model --iterations 3` where the value position is occupied by another flag.
Common situations: Developer forgets to provide a value after a value-taking flag. Two flags are accidentally adjacent. Shell quoting or variable expansion produces an empty or missing token.
Related errors
- --max-attempts must be >= 1
- Invalid integer 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/d716968dc96be340.
Report an issue: GitHub.