{"record":{"id":"afa4d399d843d109","repo":"n8n-io/n8n","slug":"unexpected-positional-argument-arg","errorCode":null,"errorMessage":"Unexpected positional argument: ${arg}","messagePattern":"Unexpected positional argument: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"packages/@n8n/instance-ai/evaluations/export-latest-verifier-request.ts","lineNumber":123,"sourceCode":"\t\t\tcase '--scenario': {\n\t\t\t\tscenarioName = argv[++i];\n\t\t\t\tif (!scenarioName) throw new Error('Missing value for --scenario');\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tif (arg.startsWith('--')) throw new Error(`Unknown flag: ${arg}`);\n\t\t\t\tif (!scenarioName) {\n\t\t\t\t\tscenarioName = arg;\n\t\t\t\t} else if (!testCasePath) {\n\t\t\t\t\ttestCasePath = path.join(\n\t\t\t\t\t\tinstanceAiRoot,\n\t\t\t\t\t\t'evaluations',\n\t\t\t\t\t\t'data',\n\t\t\t\t\t\t'workflows',\n\t\t\t\t\t\t`${arg}.json`,\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\tthrow new Error(`Unexpected positional argument: ${arg}`);\n\t\t\t\t}\n\t\t}\n\t}\n\n\treturn {\n\t\ttestCasePath:\n\t\t\ttestCasePath ??\n\t\t\tpath.join(\n\t\t\t\tinstanceAiRoot,\n\t\t\t\t'evaluations',\n\t\t\t\t'data',\n\t\t\t\t'workflows',\n\t\t\t\t'cross-team-linear-report.json',\n\t\t\t),\n\t\tscenarioName,\n\t};\n}\n","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/instance-ai/evaluations/export-latest-verifier-request.ts#L105-L141","documentation":"Thrown by the CLI argument parser in export-latest-verifier-request.ts when a third positional argument is passed on the command line. The parser accepts at most two positional values: the first becomes the scenario name and the second the test-case path (resolved under evaluations/data/workflows/). Anything beyond that, or any token not starting with '--' after both slots are filled, is rejected. Named flags (--test-case-path, --scenario) are handled separately and do not count as positional.","triggerScenarios":"Running export-latest-verifier-request with three or more bare words, e.g. `tsx export-latest-verifier-request.ts scenarioA caseB extra`. Also triggers when a typo'd flag omits its leading '--' (so it is read as a positional) after both scenario and path slots are already filled.","commonSituations":"A copy-paste of an older command with a now-removed positional; passing a workflow id or output path as a bare word instead of a flag; a shell glob expanding to multiple positionals.","solutions":["Pass at most two positional arguments: scenario name first, test case name (without .json) second.","Prefer the named flags `--scenario <name>` and `--test-case-path <abs>` to avoid positional-order confusion.","Quote shell arguments or disable globbing if a positional is expanding unexpectedly."],"exampleFix":"// before\n$ tsx export-latest-verifier-request.ts myScenario cross-team-linear-report extra-output\n// after\n$ tsx export-latest-verifier-request.ts myScenario cross-team-linear-report","handlingStrategy":"validation","validationCode":"// Validate positional count before parsing, or restrict to named flags.\nfunction assertPositionals(argv: string[]): void {\n  const positionals = argv.filter((a) => !a.startsWith('--'));\n  // exclude values consumed by named flags\n  if (positionals.length > 2) {\n    throw new Error(`Expected at most 2 positional args, got ${positionals.length}: ${positionals.join(', ')}`);\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Prefer the named flags --scenario and --test-case-path over positional order.","Document the two-positional limit at the top of parseCliArgs.","Add a usage/help string printed when parsing fails."],"tags":["cli","argument-parsing","usage"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}