{"record":{"id":"369df599cab6d3a8","repo":"n8n-io/n8n","slug":"unknown-flag-arg-split-1-0","errorCode":null,"errorMessage":"Unknown flag: ${arg.split('=', 1)[0]}","messagePattern":"Unknown flag: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@n8n/instance-ai/evaluations/computer-use/cli.ts","lineNumber":110,"sourceCode":"\t\t\t\tbreak;\n\t\t\tcase '--html':\n\t\t\t\traw.html = true;\n\t\t\t\tbreak;\n\t\t\tcase '--no-auto-start-daemon':\n\t\t\t\traw.autoStartDaemon = false;\n\t\t\t\tbreak;\n\t\t\tcase '--daemon-sandbox-dir':\n\t\t\t\traw.daemonSandboxDir = next(argv, i++, arg);\n\t\t\t\tbreak;\n\t\t\tcase '--use-published-daemon':\n\t\t\t\traw.usePublishedDaemon = true;\n\t\t\t\tbreak;\n\t\t\tcase '--keep-data':\n\t\t\t\traw.keepData = true;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tif (arg.startsWith('--')) {\n\t\t\t\t\tthrow new Error(`Unknown flag: ${arg.split('=', 1)[0]}`);\n\t\t\t\t}\n\t\t\t\tthrow new Error('Unexpected positional argument');\n\t\t}\n\t}\n\n\treturn argsSchema.parse(raw);\n}\n\nfunction next(argv: string[], idx: number, flag: string): string {\n\tconst value = argv[idx + 1];\n\tif (value === undefined || value.startsWith('--')) {\n\t\tthrow new Error(`Missing value for ${flag}`);\n\t}\n\treturn value;\n}\n\n// ---------------------------------------------------------------------------\n// Scenario discovery","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/instance-ai/evaluations/computer-use/cli.ts#L92-L128","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\n$ node cli.ts --port 5678 --filter slack\n// after\n$ node cli.ts --base-url http://localhost:5678 --filter slack","handlingStrategy":"validation","validationCode":"// Before invoking, intersect the intended argv against the accepted flag set.\nconst ACCEPTED = new Set([\n  '--base-url','--email','--password','--verbose','--filter',\n  '--timeout-ms','--output-dir','--html','--no-auto-start-daemon',\n  '--daemon-sandbox-dir','--use-published-daemon','--keep-data',\n]);\nfunction findUnknownFlags(argv: string[]): string[] {\n  return argv\n    .filter((a) => a.startsWith('--'))\n    .map((a) => a.split('=', 1)[0])\n    .filter((a) => !ACCEPTED.has(a));\n}\nconst unknown = findUnknownFlags(process.argv.slice(2));\nif (unknown.length) throw new Error(`Unknown flags: ${unknown.join(', ')}`);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["cli","argument-parsing","configuration","developer-error"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}