affaan-m/ECC · error · Error

unknown argument

Error message

unknown argument: ${arg}

What it means

parseArgs in review-with-codex.js uses an explicit allowlist of flags (--consent-to-openai, --host-provider, --timeout-seconds, --help/-h, plus any others in the chain). Any argument that matches none of the branches falls into the else and throws 'unknown argument: <arg>'. It is a strict parser: no positional arguments or unknown flags are tolerated.

Solutions

  1. Run with --help to list exactly the flags this script accepts.
  2. Use space-separated form: `--timeout-seconds 30` instead of `--timeout-seconds=30`.
  3. Fix typos in flag names; consent flag is exactly `--consent-to-openai`.
  4. Remove any positional arguments or unsupported flags from the invocation.

Example fix

// before
node review-with-codex.js --timeout-seconds=30
// Error: unknown argument: --timeout-seconds=30

// after
node review-with-codex.js --timeout-seconds 30
Defensive patterns

Strategy: validation

Validate before calling

const ALLOWED = new Set(['--consent-to-openai','--host-provider','--timeout-seconds','--help','-h']);
for (const a of argv) {
  if (a.startsWith('--') && !ALLOWED.has(a)) throw new Error(`unsupported flag: ${a}`);
}

Try / catch

try {
  run(args);
} catch (e) {
  if (String(e.message).startsWith('unknown argument:')) {
    console.error(`${e.message} — run with --help for the flag list.`);
  }
}

Prevention

When it happens

Trigger: Passing an unsupported flag like `--verbose`, `--model`, or `--timeout=30` (the parser requires space-separated form, so `--timeout-seconds=30` is itself an unknown argument), or passing a positional filename to a script that only accepts flags.

Common situations: Copy-pasting flags from another tool's CLI; using the `--flag=value` syntax where only `--flag value` is supported; a typo like `--consent-to-open-ai`; passing extra args from a wrapper that forwards "$@" indiscriminately.

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/5998c591b127f208. Report an issue: GitHub.

Appendix: source

Thrown at skills/council-multi-model/scripts/review-with-codex.js:74

  for (let index = 0; index < argv.length; index += 1) {
    const arg = argv[index];
    if (arg === '--consent-to-openai') {
      options.consent = true;
    } else if (arg === '--host-provider') {
      options.hostProvider = argv[index + 1];
      index += 1;
    } else if (arg === '--timeout-seconds') {
      const seconds = Number(argv[index + 1]);
      if (!Number.isInteger(seconds) || seconds < 10 || seconds > 120) {
        throw new Error('--timeout-seconds must be an integer from 10 to 120');
      }
      options.timeoutMs = seconds * 1000;
      index += 1;
    } else if (arg === '--help' || arg === '-h') {
      options.help = true;
    } else {
      throw new Error(`unknown argument: ${arg}`);
    }
  }

  if (options.help) return options;
  if (!options.consent) {
    throw new Error('explicit --consent-to-openai is required');
  }
  if (!HOST_PROVIDERS.has(options.hostProvider)) {
    throw new Error('--host-provider must be anthropic, openai, or unknown');
  }
  return options;
}

function providerLabel(hostProvider) {
  if (hostProvider === 'anthropic') return 'cross-provider external critique';
  if (hostProvider === 'openai') return 'same-provider external critique';
  return 'provider relationship unverified';
}

View on GitHub (pinned to 8321021c54)