{"record":{"id":"1a845de4e69cf81d","repo":"affaan-m/ECC","slug":"flagname-requires-a-value-1a845d","errorCode":null,"errorMessage":"${flagName} requires a value","messagePattern":"(.+?) requires a value","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/release-approval-gate.js","lineNumber":110,"sourceCode":"\nfunction usage() {\n  console.log([\n    'Usage: node scripts/release-approval-gate.js [--format <text|json>] [--root <dir>]',\n    '',\n    'Final approval gate for the release version declared by package.json.',\n    '',\n    'Options:',\n    '  --format <text|json>  Output format (default: text)',\n    '  --json                Alias for --format json',\n    '  --root <dir>          Repository root to inspect (default: cwd)',\n    '  --help, -h            Show this help',\n  ].join('\\n'));\n}\n\nfunction readArgValue(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 parseArgs(argv) {\n  const args = argv.slice(2);\n  const parsed = {\n    format: 'text',\n    help: false,\n    root: path.resolve(process.cwd()),\n  };\n\n  for (let index = 0; index < args.length; index += 1) {\n    const arg = args[index];\n\n    if (arg === '--help' || arg === '-h') {\n      parsed.help = true;\n      continue;","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/scripts/release-approval-gate.js#L92-L128","documentation":"Thrown by readArgValue in release-approval-gate's arg parser when a value-taking flag (--format, --root) is followed by nothing or by another `--` flag. Same strict-value guard used across ECC scripts so a flag name is never silently consumed as a value. The gate validates release readiness, so its inputs must be unambiguous.","triggerScenarios":"`--format` last; `--root --json` (root value missing); templated value that resolved empty; copy-paste that dropped the value.","commonSituations":"CI template assembles the command and a variable was empty; user edited an example and removed a value.","solutions":["Provide the value after the flag: `--format json` or `--root /repo`.","Use the `=` form: `--format=json`, `--root=/repo`.","Ensure any shell/env variable used as the value is non-empty and quoted."],"exampleFix":"# before\nnode scripts/release-approval-gate.js --root --json\n# after\nnode scripts/release-approval-gate.js --root /path/to/repo --json","handlingStrategy":"validation","validationCode":"function ensureGateFlagValue(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}","typeGuard":"function isFlagValueTok(token) {\n  return typeof token === 'string' && token.length > 0 && !token.startsWith('--');\n}","tryCatchPattern":"try {\n  parseArgs(process.argv);\n} catch (err) {\n  if (err.message.endsWith('requires a value')) {\n    console.error(`${err.message}. Use --flag=value form.`);\n    process.exit(2);\n  }\n  throw err;\n}","preventionTips":["Prefer `--format=json` / `--root=/repo`.","Assert templated CI values are non-empty before assembling the command.","release-approval-gate only accepts --format and --root."],"tags":["cli","argument-validation","release-approval-gate"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}