{"record":{"id":"3caac698bfa415bf","repo":"n8n-io/n8n","slug":"missing-value-for-flag-3caac6","errorCode":null,"errorMessage":"Missing value for ${flag}","messagePattern":"Missing value for (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@n8n/instance-ai/evaluations/cli/langtracer-push.ts","lineNumber":134,"sourceCode":"\t\t}\n\t}\n\n\tif (!result.suite) throw new Error('--suite <slug|id> is required');\n\tconst hasSelector =\n\t\tresult.slugs.length > 0 ||\n\t\tresult.changed ||\n\t\tresult.filter !== undefined ||\n\t\tresult.tier !== undefined;\n\tif (!hasSelector) {\n\t\tthrow new Error('select cases to push: pass <slugs...>, --changed, --filter, or --tier');\n\t}\n\n\treturn { helpRequested: false, args: result };\n}\n\nfunction nextArg(argv: string[], i: number, flag: string): string {\n\tconst value = argv[i + 1];\n\tif (value === undefined || value.startsWith('--')) throw new Error(`Missing value for ${flag}`);\n\treturn value;\n}\n\n/** New/untracked + staged + modified `data/{workflows,agents}/*.json` slugs, from git. */\nfunction gitChangedSlugs(): string[] {\n\tconst out = execFileSync('git', ['status', '--porcelain', '--untracked-files=all'], {\n\t\tencoding: 'utf-8',\n\t});\n\tconst slugs: string[] = [];\n\tfor (const line of out.split('\\n')) {\n\t\tif (!line.trim()) continue;\n\t\tconst raw = line.slice(3).trim(); // strip the 2-char status + space\n\t\tconst path = raw.includes(' -> ') ? raw.split(' -> ')[1] : raw; // rename → new path\n\t\tif (\n\t\t\t(path.includes('evaluations/data/workflows/') || path.includes('evaluations/data/agents/')) &&\n\t\t\tpath.endsWith('.json')\n\t\t) {\n\t\t\tslugs.push(basename(path, '.json'));","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/instance-ai/evaluations/cli/langtracer-push.ts#L116-L152","documentation":"The nextArg helper in langtracer-push (line 132) fetches the token following a flag in argv. It throws when the next token is undefined (flag is last argument) or starts with '--' (the next token looks like another flag). This prevents flags from being silently consumed as values, identical to the pattern in build-mcp-manifest.","triggerScenarios":"Running `pnpm eval:langtracer-push --suite --changed` (value after --suite is --changed), or `--suite` as the last argument with nothing following.","commonSituations":"Missing value after a value-taking flag. Two flags accidentally adjacent. Shell quoting drops a value. Variable expansion produces an empty token.","solutions":["Provide the value immediately after the flag: --suite baseline","Ensure the intended value does not start with '--'","Recheck argument ordering for missing or misplaced tokens"],"exampleFix":"# before\npnpm eval:langtracer-push --suite --changed\n\n# after\npnpm eval:langtracer-push --suite baseline --changed","handlingStrategy":"validation","validationCode":"// Validate that every value-taking flag has a non-flag next token:\nconst VALUE_FLAGS = ['--suite', '--filter', '--exclude', '--tier', '--set-kind'];\nfor (let i = 0; i < argv.length; i++) {\n  if (VALUE_FLAGS.includes(argv[i])) {\n    const next = argv[i + 1];\n    if (next === undefined || next.startsWith('--')) {\n      throw new Error(`Missing value for ${argv[i]}`);\n    }\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Provide a value immediately after each value-taking flag","Ensure values do not start with '--'","Review the full command for misplaced or missing tokens"],"tags":["cli","validation","argument-parsing","langtracer-push"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}