n8n-io/n8n · error · Error
Unknown flag: ${arg.split('=', 1)[0]}
Error message
Unknown flag: ${arg.split('=', 1)[0]} What it means
Thrown by the hand-written argument parser in the computer-use eval CLI (cli.ts) when an argv token starts with `--` but matches no case in the switch. The parser is a closed enum of known flags (--base-url, --email, --password, --verbose, --filter, --timeout-ms, --output-dir, --html, --no-auto-start-daemon, --daemon-sandbox-dir, --use-published-daemon, --keep-data); anything else is rejected before zod ever runs. The `arg.split('=', 1)[0]` form strips any `=value` suffix so the message reports the flag name, not its value.
Source
Thrown at packages/@n8n/instance-ai/evaluations/computer-use/cli.ts:110
break;
case '--html':
raw.html = true;
break;
case '--no-auto-start-daemon':
raw.autoStartDaemon = false;
break;
case '--daemon-sandbox-dir':
raw.daemonSandboxDir = next(argv, i++, arg);
break;
case '--use-published-daemon':
raw.usePublishedDaemon = true;
break;
case '--keep-data':
raw.keepData = true;
break;
default:
if (arg.startsWith('--')) {
throw new Error(`Unknown flag: ${arg.split('=', 1)[0]}`);
}
throw new Error('Unexpected positional argument');
}
}
return argsSchema.parse(raw);
}
function next(argv: string[], idx: number, flag: string): string {
const value = argv[idx + 1];
if (value === undefined || value.startsWith('--')) {
throw new Error(`Missing value for ${flag}`);
}
return value;
}
// ---------------------------------------------------------------------------
// Scenario discoveryView on GitHub (pinned to 5ac6606e81)
Solutions
- Run the CLI with no args or with `--help` equivalent (inspect parseArgs switch at cli.ts:71-107) to list accepted flags, then correct the offending token.
- If you meant the n8n base URL, use `--base-url <url>` (not `--port`, `--host`, or `--url`).
- If you intended a value-bearing flag written as `--flag=value`, confirm the flag name itself is in the accepted set; the parser accepts the `=` form only for known flags via the `next()` helper, not via the default branch.
- Check for stale shell history or a wrapper script that injects a flag removed in the current checkout.
Example fix
// before $ node cli.ts --port 5678 --filter slack // after $ node cli.ts --base-url http://localhost:5678 --filter slack
Defensive patterns
Strategy: validation
Validate before calling
// Before invoking, intersect the intended argv against the accepted flag set.
const ACCEPTED = new Set([
'--base-url','--email','--password','--verbose','--filter',
'--timeout-ms','--output-dir','--html','--no-auto-start-daemon',
'--daemon-sandbox-dir','--use-published-daemon','--keep-data',
]);
function findUnknownFlags(argv: string[]): string[] {
return argv
.filter((a) => a.startsWith('--'))
.map((a) => a.split('=', 1)[0])
.filter((a) => !ACCEPTED.has(a));
}
const unknown = findUnknownFlags(process.argv.slice(2));
if (unknown.length) throw new Error(`Unknown flags: ${unknown.join(', ')}`); Prevention
- Centralize the accepted-flag set in one exported constant and have the parser and any pre-flight validator both reference it, so they can't drift.
- Add a `--help` that prints the accepted set, generated from the same source of truth.
- In wrapper scripts, assert against the accepted set before invoking so a stale flag fails early with a clear context.
When it happens
Trigger: Pass an unrecognized flag like `--port 5678` (the correct flag is `--base-url`), or carry over a flag from a sibling tool (e.g. `--source langtracer` belongs to the workflow/agent eval CLI, not this one). Also triggered by typos: `--verbsoe`, `--kepe-data`. Any `--foo=bar` form where `foo` is unknown hits the same branch.
Common situations: Developers copy a command from one eval tool's README into another; the three CLIs (computer-use/cli.ts, the workflow/agent eval entry, and export-latest-verifier-request.ts) share look-alike flags but not the same set. CI scripts upgraded after a flag rename (e.g. a flag renamed between versions) silently carry the old spelling. Shell history autocomplete picks a stale flag.
Related errors
- Unexpected positional argument
- Missing value for ${flag}
- --source langtracer requires --suite <slug>
- No test cases match --tier "${tier}". Known tiers: ${known.j
- Missing value for ${arg}
AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12).
Data as JSON: /api/errors/369df599cab6d3a8.
Report an issue: GitHub.