affaan-m/ECC · error · Error

Missing issue number.

Error message

Missing issue number.

What it means

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.

Solutions

  1. Pass the issue number explicitly: add --issue-number <n> (or the flag name parseArgs expects) to the command line.
  2. Verify options.issueNumber reaches dispatchCommand — check parseArgs in the same file for the exact flag spelling.
  3. In scripts, guard the value before invoking: `[ -n "$ISSUE" ] || { echo 'issue number required'; exit 1; }`.
  4. If wrapping dispatchCommand, validate `options.command === 'claim' && options.issueNumber` before calling.

Example fix

// before
node scripts/github-coordination.js claim --repo owner/repo

// after
node scripts/github-coordination.js claim --repo owner/repo --issue-number 42
Defensive patterns

Strategy: validation

Validate before calling

if (options.command === 'claim' && !options.issueNumber) {
  throw new Error('claim requires --issue-number');
}
dispatchCommand(options, ctx);

Type guard

function hasIssueNumber(o) {
  return typeof o.issueNumber === 'number' && Number.isInteger(o.issueNumber) && o.issueNumber > 0;
}

Try / catch

try {
  dispatchCommand(options, ctx);
} catch (e) {
  if (e.message === 'Missing issue number.') {
    console.error('Usage: claim --repo <owner/repo> --issue-number <n>');
    process.exit(2);
  }
  throw e;
}

Prevention

When it happens

Trigger: Running the CLI with `claim` but no --issue-number flag, or programmatically calling dispatchCommand({command:'claim', ...}) with issueNumber undefined/null/empty string.

Common situations: 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.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16). Data as JSON: /api/errors/91fb7c8ef470fe46. Report an issue: GitHub.

Appendix: source

Thrown at scripts/github-coordination.js:123

    } else {
      throw new Error(`Unknown argument: ${arg}`);
    }
  }

  if (!parsed.command) parsed.command = 'sync';
  if (!parsed.issueNumber && parsed.positionals.length > 0) {
    parsed.issueNumber = normalizeIssueNumber(parsed.positionals[0]);
  }

  return parsed;
}

function dispatchCommand(options, ctx) {
  const { store, policy, rootDir } = ctx;
  const base = { configPath: options.configPath, dryRun: options.dryRun };

  if (options.command === 'claim') {
    if (!options.issueNumber) throw new Error('Missing issue number.');
    return applyClaim(options.repo, options.issueNumber, {
      ...base, actor: options.actor, branch: options.branch, owner: options.actor,
      projectState: options.projectState, review: options.review,
      status: options.status, validation: options.validation,
    }, { store, policy, rootDir });
  }
  if (options.command === 'sync') {
    return applySync(options.repo, { ...base, limit: options.limit }, { store, policy, rootDir });
  }
  if (options.command === 'validate') {
    if (!options.issueNumber) throw new Error('Missing issue number.');
    return applyValidate(options.repo, options.issueNumber, base, { store, policy, rootDir });
  }
  if (options.command === 'publish') {
    if (!options.issueNumber) throw new Error('Missing issue number.');
    return applyPublish(options.repo, options.issueNumber, base, { store, policy, rootDir });
  }
  if (options.command === 'review') {

View on GitHub (pinned to 8321021c54)