{"record":{"id":"d5c646201e0286a9","repo":"affaan-m/ECC","slug":"flagname-requires-a-value-d5c646","errorCode":null,"errorMessage":"${flagName} requires a value","messagePattern":"(.+?) requires a value","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/github-coordination.js","lineNumber":53,"sourceCode":"    '  --repo <owner/repo>      GitHub repository',\n    '  --issue <number>         Issue number for actions that target one issue',\n    '  --actor <login>          Claim owner / coordination actor',\n    '  --branch <name>          Epic branch name to stamp into the coordination body',\n    '  --config <path>          Optional coordination policy config',\n    '  --db <path>              SQLite state store path',\n    '  --home <dir>             Override home directory used by the state store',\n    '  --limit <n>              Limit issues scanned by sync/unblock',\n    '  --dry-run                Preview changes without modifying GitHub or state',\n    '  --json                   Emit machine-readable JSON',\n    '  --help, -h               Show this help',\n  ].join('\\n'));\n  process.exit(exitCode);\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\n// Boolean flags: map flag string → setter(parsed)\nconst BOOL_FLAGS = new Map([\n  ['--help',    p => { p.help = true; }],\n  ['-h',        p => { p.help = true; }],\n  ['--json',    p => { p.json = true; }],\n  ['--dry-run', p => { p.dryRun = true; }],\n]);\n\n// Value flags: map flag string → setter(parsed, value)\nconst VALUE_FLAGS = new Map([\n  ['--repo',          (p, v) => { p.repo = v; }],\n  ['--actor',         (p, v) => { p.actor = v; }],\n  ['--branch',        (p, v) => { p.branch = v; }],\n  ['--config',        (p, v) => { p.configPath = v; }],","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/scripts/github-coordination.js#L35-L71","documentation":"Thrown by readValue() in scripts/github-coordination.js when a value-expecting flag (like --repo, --issue, --config, --limit, --home) is either the last argument or is followed by another flag (a token starting with '--'). The function checks that the next token exists and does not look like a flag name.","triggerScenarios":"Running `node scripts/github-coordination.js --repo` (no value after flag), or `node scripts/github-coordination.js --repo --issue 5` (--repo followed by another flag). Any VALUE_FLAGS entry whose next arg is missing or starts with '--' triggers this.","commonSituations":"Forgetting to supply the value for a flag, accidentally putting flags in the wrong order, or a shell quoting issue that drops the value. Common with copy-pasted commands where a value was omitted.","solutions":["Provide a value immediately after the flag: `--repo owner/repo`.","Reorder arguments so a value-expecting flag is never immediately followed by another flag.","Check shell quoting: values with spaces or special characters should be quoted.","Run with --help to see which flags require values."],"exampleFix":"// before\nnode scripts/github-coordination.js sync --repo --issue 5\n// after\nnode scripts/github-coordination.js sync --repo owner/repo --issue 5","handlingStrategy":"validation","validationCode":"function safeReadValue(args, index, flagName) {\n  const value = args[index + 1];\n  if (!value || value.startsWith('--')) {\n    console.error(`${flagName} requires a value. Usage: ${flagName} <value>`);\n    process.exit(2);\n  }\n  return value;\n}","typeGuard":"function hasFlagValue(args, index) {\n  const next = args[index + 1];\n  return typeof next === 'string' && next.length > 0 && !next.startsWith('--');\n}","tryCatchPattern":null,"preventionTips":["Construct CLI commands from validated argument lists in automation.","Add shell completion that inserts placeholder values for value flags.","Test commands with a dry-run or --help before executing in pipelines."],"tags":["cli","argument-parsing","github","user-input"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}