{"record":{"id":"91fb7c8ef470fe46","repo":"affaan-m/ECC","slug":"missing-issue-number","errorCode":null,"errorMessage":"Missing issue number.","messagePattern":"Missing issue number\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/github-coordination.js","lineNumber":123,"sourceCode":"    } else {\n      throw new Error(`Unknown argument: ${arg}`);\n    }\n  }\n\n  if (!parsed.command) parsed.command = 'sync';\n  if (!parsed.issueNumber && parsed.positionals.length > 0) {\n    parsed.issueNumber = normalizeIssueNumber(parsed.positionals[0]);\n  }\n\n  return parsed;\n}\n\nfunction dispatchCommand(options, ctx) {\n  const { store, policy, rootDir } = ctx;\n  const base = { configPath: options.configPath, dryRun: options.dryRun };\n\n  if (options.command === 'claim') {\n    if (!options.issueNumber) throw new Error('Missing issue number.');\n    return applyClaim(options.repo, options.issueNumber, {\n      ...base, actor: options.actor, branch: options.branch, owner: options.actor,\n      projectState: options.projectState, review: options.review,\n      status: options.status, validation: options.validation,\n    }, { store, policy, rootDir });\n  }\n  if (options.command === 'sync') {\n    return applySync(options.repo, { ...base, limit: options.limit }, { store, policy, rootDir });\n  }\n  if (options.command === 'validate') {\n    if (!options.issueNumber) throw new Error('Missing issue number.');\n    return applyValidate(options.repo, options.issueNumber, base, { store, policy, rootDir });\n  }\n  if (options.command === 'publish') {\n    if (!options.issueNumber) throw new Error('Missing issue number.');\n    return applyPublish(options.repo, options.issueNumber, base, { store, policy, rootDir });\n  }\n  if (options.command === 'review') {","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/github-coordination.js#L105-L141","documentation":"dispatchCommand in scripts/github-coordination.js routes CLI subcommands to their apply* handlers. For the 'claim' command it requires an issue number; if options.issueNumber is falsy, it throws 'Missing issue number.' before any work is done. This is a fail-fast guard so the claim operation never runs against an undefined issue.","triggerScenarios":"Running the CLI with `claim` but no --issue-number flag, or programmatically calling dispatchCommand({command:'claim', ...}) with issueNumber undefined/null/empty string.","commonSituations":"Typing `node scripts/github-coordination.js claim --repo owner/repo` and forgetting the issue flag; a shell script building options dynamically where the issue number variable was empty; a wrapper passing parsed options that dropped the flag due to a rename.","solutions":["Pass the issue number explicitly: add --issue-number <n> (or the flag name parseArgs expects) to the command line.","Verify options.issueNumber reaches dispatchCommand — check parseArgs in the same file for the exact flag spelling.","In scripts, guard the value before invoking: `[ -n \"$ISSUE\" ] || { echo 'issue number required'; exit 1; }`.","If wrapping dispatchCommand, validate `options.command === 'claim' && options.issueNumber` before calling."],"exampleFix":"// before\nnode scripts/github-coordination.js claim --repo owner/repo\n\n// after\nnode scripts/github-coordination.js claim --repo owner/repo --issue-number 42","handlingStrategy":"validation","validationCode":"if (options.command === 'claim' && !options.issueNumber) {\n  throw new Error('claim requires --issue-number');\n}\ndispatchCommand(options, ctx);","typeGuard":"function hasIssueNumber(o) {\n  return typeof o.issueNumber === 'number' && Number.isInteger(o.issueNumber) && o.issueNumber > 0;\n}","tryCatchPattern":"try {\n  dispatchCommand(options, ctx);\n} catch (e) {\n  if (e.message === 'Missing issue number.') {\n    console.error('Usage: claim --repo <owner/repo> --issue-number <n>');\n    process.exit(2);\n  }\n  throw e;\n}","preventionTips":["Always pass --issue-number explicitly with claim.","Keep issue number in a required variable validated at script start.","Document the flag in your team's runbook next to the claim command.","Add a shell assertion before invoking the CLI."],"tags":["cli","validation","missing-argument"],"backgroundTag":"missing-required-argument","analyzedSha":"8321021c54d670126ce3b2969d5deb880b4b0c2a","analyzedAt":"2026-09-16T10:08:13.343Z","contentChangedAt":"2026-09-16T10:08:13.343Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}