{"record":{"id":"0d4e559356064f5c","repo":"n8n-io/n8n","slug":"invalid-integer-for-flagname","errorCode":null,"errorMessage":"Invalid integer for ${flagName}","messagePattern":"Invalid integer for (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@n8n/instance-ai/evaluations/cli/args.ts","lineNumber":536,"sourceCode":"\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":518,"sourceCodeEnd":540,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/instance-ai/evaluations/cli/args.ts#L518-L540","documentation":"Thrown by the parseIntArg() helper (args.ts:536) when parseInt(raw, 10) returns NaN for a flag that expects an integer. The raw value is intentionally not echoed in the message, because a bad shell expansion could leak a secret into the terminal/CI log. Affected flags: --timeout-ms, --iterations, --concurrency, --build-max-attempts, --build-mcp-timeout-ms, --build-timeout-ms.","triggerScenarios":"Passing a non-numeric value (a word, a float with junk, an empty expansion, or a shell variable that resolved to nothing) to an integer flag. For example `--iterations abc`, `--concurrency $MISSING_VAR`, or `--timeout-ms 1e6` (exponential notation may fail depending on parseInt behavior). Note: parseInt('123abc') returns 123, so partial-numeric values may slip through; only fully non-numeric prefixes trip NaN.","commonSituations":"A shell variable for a numeric setting is unset or misspelled, a value was copy-pasted with a unit suffix (e.g. 30s instead of 30000ms), or a decimal was passed where an int was expected and the leading part was non-numeric.","solutions":["Provide a valid base-10 integer with no units or suffixes (e.g. 300000 for milliseconds).","Verify any shell variables used for numeric flags are set: `echo \"${ITERATIONS:?unset}\"`.","Check units: --timeout-ms and --build-timeout-ms are milliseconds, not seconds."],"exampleFix":"// before\npnpm eval:instance-ai --timeout-ms 30s\n// after\npnpm eval:instance-ai --timeout-ms 30000","handlingStrategy":"validation","validationCode":"const INT_FLAGS = new Set(['--timeout-ms','--iterations','--concurrency','--build-max-attempts','--build-mcp-timeout-ms','--build-timeout-ms']);\nfunction validateIntFlags(args: string[]): void {\n  for (let i = 0; i < args.length; i++) {\n    if (INT_FLAGS.has(args[i].split('=',1)[0])) {\n      const v = args[i + 1];\n      if (v === undefined || !/^\\d+$/.test(v)) {\n        throw new Error(`Invalid integer for ${args[i]}: ${v === undefined ? '(missing)' : v}`);\n      }\n    }\n  }\n}","typeGuard":"function isIntegerFlagValue(v: string): boolean {\n  return /^\\d+$/.test(v);\n}","tryCatchPattern":null,"preventionTips":["Never append units (s, ms) to integer flag values — use raw milliseconds.","Verify shell variables for numeric flags are set and numeric: `${VAR:?}` plus a regex check.","Remember --timeout-ms and --build-timeout-ms are milliseconds, not seconds."],"tags":["cli","argument-validation","instance-ai","security"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}