{"record":{"id":"ad9c057a4a93110c","repo":"n8n-io/n8n","slug":"name-must-be-a-positive-number-got-raw","errorCode":null,"errorMessage":"${name} must be a positive number, got \"${raw}\".","messagePattern":"(.+?) must be a positive number, got \"(.+?)\"\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@n8n/instance-ai/evaluations/cli/pairwise.ts","lineNumber":124,"sourceCode":"\t\tbaseUrl: get('--base-url') ?? process.env.N8N_EVAL_BASE_URL ?? 'http://localhost:5678',\n\t\tkeepWorkflows: has('--keep-workflows'),\n\t};\n}\n\nfunction parsePositiveInt(raw: string | undefined, name: string): number | undefined {\n\tif (raw === undefined || raw === '') return undefined;\n\tconst n = Number(raw);\n\tif (!Number.isFinite(n) || n <= 0 || !Number.isInteger(n)) {\n\t\tthrow new Error(`${name} must be a positive integer, got \"${raw}\".`);\n\t}\n\treturn n;\n}\n\nfunction parsePositiveNumber(raw: string | undefined, name: string): number | undefined {\n\tif (raw === undefined || raw === '') return undefined;\n\tconst n = Number(raw);\n\tif (!Number.isFinite(n) || n <= 0) {\n\t\tthrow new Error(`${name} must be a positive number, got \"${raw}\".`);\n\t}\n\treturn n;\n}\n\n// ---------------------------------------------------------------------------\n// Dataset loading\n// ---------------------------------------------------------------------------\n\ninterface DatasetExample {\n\tid: string;\n\tprompt: string;\n\tdos?: string;\n\tdonts?: string;\n}\n\nasync function loadExamples(args: PairwiseArgs, logger: EvalLogger): Promise<DatasetExample[]> {\n\tif (args.examplesJsonl) {\n\t\treturn loadExamplesFromJsonl(args.examplesJsonl, logger);","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/instance-ai/evaluations/cli/pairwise.ts#L106-L142","documentation":"parsePositiveNumber is the fractional-tolerant sibling of parsePositiveInt, used for flags that may be decimals (e.g. temperature-like values). It rejects undefined/empty (returns undefined) but throws on NaN, non-finite, zero, or negative values.","triggerScenarios":"Passing `--threshold 0`, `--rate -0.5`, or a non-numeric string to a flag validated by parsePositiveNumber.","commonSituations":"Misremembering a flag as accepting zero; passing a percentage as 0..1 vs 0..100 and hitting zero; shell quoting turning a number into garbage.","solutions":["Re-run with a positive number (decimals allowed) for the named flag.","If zero is genuinely valid for your use case, file a change to the validator; do not bypass it.","Validate the value in your wrapper script before invoking the CLI."],"exampleFix":"// before: pnpm pairwise --temperature 0\n// after:  pnpm pairwise --temperature 0.2","handlingStrategy":"validation","validationCode":"function asPositiveNumber(raw: string | undefined, name: string): number | undefined {\n  if (raw === undefined || raw === '') return undefined;\n  const n = Number(raw);\n  if (!Number.isFinite(n) || n <= 0) throw new Error(`${name} must be a positive number`);\n  return n;\n}","typeGuard":"const isPositiveNumber = (v: unknown): v is number =>\n  typeof v === 'number' && Number.isFinite(v) && v > 0;","tryCatchPattern":null,"preventionTips":["Validate numeric args before invoking.","Distinguish integer vs float flags in docs.","Reject zero explicitly if zero is invalid."],"tags":["cli","validation","args"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}