{"record":{"id":"d30d3255ed495783","repo":"n8n-io/n8n","slug":"unknown-flag-flagname","errorCode":null,"errorMessage":"Unknown flag: ${flagName}","messagePattern":"Unknown flag: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@n8n/instance-ai/evaluations/cli/args.ts","lineNumber":510,"sourceCode":"\t\t\t\tresult.buildMcpTimeoutMs = parseIntArg(argv, i, '--build-mcp-timeout-ms');\n\t\t\t\tresult.buildOnlyFlags.push(arg);\n\t\t\t\ti++;\n\t\t\t\tbreak;\n\n\t\t\tcase '--build-timeout-ms':\n\t\t\t\tresult.buildTimeoutMs = parseIntArg(argv, i, '--build-timeout-ms');\n\t\t\t\tresult.buildOnlyFlags.push(arg);\n\t\t\t\ti++;\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\t// Fail loudly on unknown flags. Strip any =value payload before\n\t\t\t\t// echoing and drop positional values entirely — raw CLI input\n\t\t\t\t// may contain secrets (e.g. --password=... or an accidentally\n\t\t\t\t// pasted token) that would otherwise leak into terminal/CI logs.\n\t\t\t\tif (arg.startsWith('--')) {\n\t\t\t\t\tconst flagName = arg.split('=', 1)[0];\n\t\t\t\t\tthrow new Error(`Unknown flag: ${flagName}`);\n\t\t\t\t}\n\t\t\t\tthrow new Error('Unexpected positional argument');\n\t\t}\n\t}\n\n\treturn result;\n}\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\nfunction nextArg(argv: string[], currentIndex: number, flagName: string): string {\n\tconst value = argv[currentIndex + 1];\n\tif (value === undefined || value.startsWith('--')) {\n\t\tthrow new Error(`Missing value for ${flagName}`);\n\t}\n\treturn value;","sourceCodeStart":492,"sourceCodeEnd":528,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/instance-ai/evaluations/cli/args.ts#L492-L528","documentation":"Thrown by the default case of parseRawArgs() (args.ts:510) when an argument starts with -- but does not match any known flag case. The flag name is sanitized by splitting on '=' and taking only the first segment before echoing, so that a value payload (which may contain a secret like --password=hunter2 or an accidentally pasted token) is never leaked into terminal or CI logs. This is a deliberate security-conscious design choice noted in the source comment.","triggerScenarios":"Passing any unrecognized long flag to the eval CLI, e.g. --verbose-mode instead of --verbose, or a typo like --buld-via-mcp. Also triggered by flags that belong to a different tool (e.g. build-mcp-manifest flags passed to eval:instance-ai). The flag name is stripped of any =value before being reported.","commonSituations":"Typo in a flag name, using a flag from a different CLI in this repo, or referencing a flag that was renamed or removed in a version change. The error message intentionally does not echo the value portion for security.","solutions":["Check the flag spelling against the known cases in parseRawArgs() (args.ts:359-501): --timeout-ms, --base-url, --email, --password, --verbose, --filter, --exclude, --prebuilt-workflows, --keep-workflows, --delete-prebuilt-workflows, --output-dir, --iterations, --dataset, --concurrency, --experiment-name, --pin-ai-roots, --tier, --baseline-prefix, --source, --suite, --build-via-mcp, --mcp-server, --build-cwd, --build-max-attempts, --build-mcp-timeout-ms, --build-timeout-ms.","Use the correct tool: some flags (e.g. --manifest, --builder, --append) belong to build-mcp-manifest, not eval:instance-ai.","Correct the typo or remove the unrecognized flag."],"exampleFix":"// before\npnpm eval:instance-ai --buld-via-mcp --base-url http://localhost:5678\n// after\npnpm eval:instance-ai --build-via-mcp --base-url http://localhost:5678","handlingStrategy":"validation","validationCode":"const KNOWN_FLAGS = new Set(['--timeout-ms','--base-url','--email','--password','--verbose','--filter','--exclude','--prebuilt-workflows','--keep-workflows','--delete-prebuilt-workflows','--output-dir','--iterations','--dataset','--concurrency','--experiment-name','--pin-ai-roots','--tier','--baseline-prefix','--source','--suite','--build-via-mcp','--mcp-server','--build-cwd','--build-max-attempts','--build-mcp-timeout-ms','--build-timeout-ms']);\nfunction validateKnownFlags(args: string[]): void {\n  for (const a of args) {\n    if (a.startsWith('--') && !KNOWN_FLAGS.has(a.split('=',1)[0])) {\n      throw new Error(`Unknown flag: ${a.split('=',1)[0]}`);\n    }\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep a documented list of supported eval CLI flags in your runbook.","Run commands through a wrapper that validates flags before exec.","Use shell completion or a CLI generator if the flag set grows.","Never paste a flag from a different tool without checking it exists here."],"tags":["cli","argument-validation","security","instance-ai"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}