{"record":{"id":"13d2583e6c2d6304","repo":"n8n-io/n8n","slug":"missing-value-for-flagname","errorCode":null,"errorMessage":"Missing value for ${flagName}","messagePattern":"Missing value for (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@n8n/instance-ai/evaluations/cli/args.ts","lineNumber":526,"sourceCode":"\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;\n}\n\nfunction parseIntArg(argv: string[], currentIndex: number, flagName: string): number {\n\tconst raw = nextArg(argv, currentIndex, flagName);\n\tconst parsed = parseInt(raw, 10);\n\tif (Number.isNaN(parsed)) {\n\t\t// Don't echo raw — a bad shell expansion could leak a secret here.\n\t\tthrow new Error(`Invalid integer for ${flagName}`);\n\t}\n\treturn parsed;\n}\n","sourceCodeStart":508,"sourceCodeEnd":540,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/instance-ai/evaluations/cli/args.ts#L508-L540","documentation":"Thrown by the nextArg() helper (args.ts:526) when a flag that expects a value is either the last token in argv or is immediately followed by another --flag. The helper refuses to consume a following --token as a value because that would silently swallow the next flag's name. This protects against malformed commands where a value was forgotten.","triggerScenarios":"Any value-taking flag (--timeout-ms, --base-url, --email, --password, --filter, --exclude, --prebuilt-workflows, --output-dir, --iterations, --dataset, --concurrency, --experiment-name, --pin-ai-roots, --tier, --baseline-prefix, --source, --suite, --mcp-server, --build-cwd, --build-max-attempts, --build-mcp-timeout-ms, --build-timeout-ms) placed at the end of the command, or immediately before another --flag.","commonSituations":"A value is accidentally deleted during command editing, a shell variable expansion produced an empty/missing value, or flags were reordered so a value landed elsewhere. Also common when a value starts with -- (e.g. a negative number is fine, but a string value beginning with -- is rejected).","solutions":["Provide a value immediately after the flag: `--flag value`.","If the intended value genuinely starts with --, pass it in =form if supported, or quote/restructure the command so it is not ambiguous.","Re-check the command for a missing value due to editing or copy-paste."],"exampleFix":"// before\npnpm eval:instance-ai --base-url --filter contact-form\n// after\npnpm eval:instance-ai --base-url http://localhost:5678 --filter contact-form","handlingStrategy":"validation","validationCode":"const VALUE_FLAGS = new Set(['--timeout-ms','--base-url','--email','--password','--filter','--exclude','--prebuilt-workflows','--output-dir','--iterations','--dataset','--concurrency','--experiment-name','--pin-ai-roots','--tier','--baseline-prefix','--source','--suite','--mcp-server','--build-cwd','--build-max-attempts','--build-mcp-timeout-ms','--build-timeout-ms']);\nfunction validateFlagValues(args: string[]): void {\n  for (let i = 0; i < args.length; i++) {\n    if (VALUE_FLAGS.has(args[i].split('=',1)[0])) {\n      const v = args[i + 1];\n      if (v === undefined || v.startsWith('--')) {\n        throw new Error(`Missing value for ${args[i]}`);\n      }\n    }\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pair every value flag with its value on the same line in scripts.","Avoid shell expansions that can produce empty values for flag arguments.","For values starting with --, restructure the command."],"tags":["cli","argument-validation","instance-ai"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}