affaan-m/ECC · error · Error

Unknown argument

Error message

Unknown argument: ${arg}

What it means

parseArgs() in scripts/github-coordination.js matches each argument against VALUE_FLAGS and BOOL_FLAGS and treats non-flag tokens as positionals. Any '--'-prefixed argument in neither map throws 'Unknown argument: <arg>'.

Solutions

  1. Check the BOOL_FLAGS and VALUE_FLAGS maps (or script help) in scripts/github-coordination.js for valid flag names.
  2. Fix the typo, e.g. `--issue` instead of `--issu`.
  3. Remove flags that aren't supported; positional issue numbers are accepted without a flag.

Example fix

// before
$ node scripts/github-coordination.js --issu 42
Error: Unknown argument: --issu
// after
$ node scripts/github-coordination.js --issue 42
Defensive patterns

Strategy: validation

Validate before calling

const KNOWN = new Set(['--issue','--status','--repo','--help','-h']);
const bad = process.argv.slice(2).filter(a => a.startsWith('--') && !KNOWN.has(a));
if (bad.length) {
  console.error(`Unknown flags: ${bad.join(', ')}`);
  process.exit(1);
}

Type guard

const isKnownFlag = (arg) => BOOL_FLAGS.has(arg) || VALUE_FLAGS.has(arg);

Try / catch

try {
  run(argv);
} catch (err) {
  if (/^Unknown argument:/.test(err.message)) {
    console.error(`${err.message}\nSee scripts/github-coordination.js flag maps for valid options.`);
    process.exit(1);
  }
  throw err;
}

Prevention

When it happens

Trigger: Passing an unrecognized or misspelled flag such as `--issu 42`, `--verbose`, or flags copied from other scripts that github-coordination.js doesn't implement.

Common situations: Typos in flags, mixing up flag sets between ECC scripts (feedback.js vs github-coordination.js), using deprecated flags after a script update, or shell aliasing that injects extra options.

Understand the failure class

Background: "Unknown argument", "Invalid value", and "must be one of": invalid CLI argument errors explained — this error's family across 35 libraries.

Related errors


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

Appendix: source

Thrown at scripts/github-coordination.js:106

    validation: null, review: null, status: null, projectState: null,
    positionals: [],
  };

  if (args.length > 0 && !args[0].startsWith('-')) {
    parsed.command = args.shift();
  }

  for (let i = 0; i < args.length; i += 1) {
    const arg = args[i];
    if (BOOL_FLAGS.has(arg)) {
      BOOL_FLAGS.get(arg)(parsed);
    } else if (VALUE_FLAGS.has(arg)) {
      VALUE_FLAGS.get(arg)(parsed, readValue(args, i, arg));
      i += 1;
    } else if (!arg.startsWith('-')) {
      parsed.positionals.push(arg);
    } 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, {

View on GitHub (pinned to 8321021c54)