{"record":{"id":"5b203643b6f99418","repo":"affaan-m/ECC","slug":"flagname-requires-a-value-5b2036","errorCode":null,"errorMessage":"${flagName} requires a value","messagePattern":"(.+?) requires a value","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/operator-readiness-dashboard.js","lineNumber":45,"sourceCode":"    '  --write <path>             Write json or markdown output to a file',\n    '  --root <dir>               Repository root to inspect (default: cwd)',\n    '  --repo <owner/repo>        GitHub repo to inspect; repeatable',\n    '  --skip-github              Skip live GitHub queue/discussion checks',\n    '  --max-open-prs <n>         PR budget passed through to platform:audit',\n    '  --max-open-issues <n>      Issue budget passed through to platform:audit',\n    '  --max-dirty-files <n>      Dirty-file budget passed through to platform:audit',\n    '  --allow-untracked <path>   Ignore untracked files under path; repeatable',\n    '  --use-env-github-token     Keep GITHUB_TOKEN when invoking gh',\n    '  --generated-at <iso>       Override generatedAt for deterministic tests',\n    '  --exit-code                Return 2 when the objective is not ready',\n    '  --help, -h                 Show this help',\n  ].join('\\n'));\n}\n\nfunction readValue(args, index, flagName) {\n  const value = args[index + 1];\n  if (!value || value.startsWith('--')) {\n    throw new Error(`${flagName} requires a value`);\n  }\n  return value;\n}\n\nfunction parseIntegerFlag(value, flagName) {\n  const parsed = Number.parseInt(value, 10);\n  if (!Number.isFinite(parsed) || parsed < 0) {\n    throw new Error(`Invalid ${flagName}: ${value}`);\n  }\n  return parsed;\n}\n\nfunction normalizeRelativePrefix(value) {\n  const normalized = String(value || '')\n    .replace(/\\\\/g, '/')\n    .replace(/^\\.\\/+/, '')\n    .replace(/\\/+$/, '');\n  return normalized ? `${normalized}/` : '';","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/scripts/operator-readiness-dashboard.js#L27-L63","documentation":"Thrown by readValue in scripts/operator-readiness-dashboard.js when a value-taking flag (--write, --root, --repo, --allow-untracked, --max-open-prs, --max-open-issues, --max-dirty-files, --generated-at) is the last token or is immediately followed by another `--` flag. Same manual-parser pattern as the sibling readiness script.","triggerScenarios":"Running `node scripts/operator-readiness-dashboard.js --write` at end of line, or `--repo --json` where the repo value is missing. Equals-form variants (`--repo=owner/name`) bypass readValue entirely and are safe.","commonSituations":"A CI step templating flags where a variable for the value is empty; reordered flags that place a value-taking flag next to the following flag; truncation during copy-paste.","solutions":["Supply the value immediately after the flag: `--write report.json`.","Use the equals form: `--write=report.json`.","Validate that variables expanding into flag values are non-empty before invoking the CLI."],"exampleFix":"// before\nnode scripts/operator-readiness-dashboard.js --repo --json\n// after\nnode scripts/operator-readiness-dashboard.js --repo owner/repo --json","handlingStrategy":"validation","validationCode":"const VALUE_FLAGS = new Set(['--write', '--root', '--repo', '--allow-untracked', '--max-open-prs', '--max-open-issues', '--max-dirty-files', '--generated-at']);\nfunction validateValueFlags(argv) {\n  for (let i = 0; i < argv.length; i++) {\n    if (VALUE_FLAGS.has(argv[i])) {\n      const next = argv[i + 1];\n      if (!next || next.startsWith('--')) throw new Error(`${argv[i]} requires a value`);\n    }\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Prefer equals forms (`--repo=owner/name`) in templated commands.","Keep the value-flag set in sync with the script's --help output after upgrades.","In CI, fail builds when a templated flag value is empty rather than letting it through."],"tags":["cli","operator-dashboard","argument-validation"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}