affaan-m/ECC · error

Unknown argument

Error message

Unknown argument: ${arg}

What it means

parseArgs in scripts/skills-health.js iterates argv and only recognizes a fixed set of flags. When it encounters a token it does not match (falling through all known-flag branches), it throws "Unknown argument: <arg>". This fail-fast behavior catches typos and unsupported flags instead of ignoring them.

Solutions

  1. Run `node scripts/skills-health.js --help` (or read the script) to list supported flags.
  2. Correct the flag spelling to one of the supported options (e.g. --panel).
  3. Remove the unsupported argument if it was intended for a different script.

Example fix

// before
node scripts/skills-health.js --verbose
// after
node scripts/skills-health.js --panel overview
Defensive patterns

Strategy: validation

Validate before calling

const SUPPORTED = new Set(['--panel', '--json', '--help', '-h']);
const unknown = argv.filter(a => a.startsWith('--') && !SUPPORTED.has(a));
if (unknown.length) console.error('Unsupported flags:', unknown);

Try / catch

try {
  runHealthScript(argv);
} catch (e) {
  if (e.message.startsWith('Unknown argument')) {
    console.error(`${e.message}. Run with --help for valid flags.`);
    process.exitCode = 1;
  } else throw e;
}

Prevention

When it happens

Trigger: Calling `node scripts/skills-health.js --pannel overview` (typo), or passing a flag like `--verbose` that this script does not implement; any argv token not in the known-flag list reaches the final throw.

Common situations: Typos in long flag names; confusing this script's options with another ECC script's; copying a command from docs of a different version where the flag was renamed or removed.

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/60be04cdbd6a1a97. Report an issue: GitHub.

Appendix: source

Thrown at scripts/skills-health.js:104

    if (arg === '--warn-threshold') {
      options.warnThreshold = Number(requireValue(argv, index, '--warn-threshold'));
      index += 1;
      continue;
    }

    if (arg === '--dashboard') {
      options.dashboard = true;
      continue;
    }

    if (arg === '--panel') {
      options.panel = requireValue(argv, index, '--panel');
      index += 1;
      continue;
    }

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

  return options;
}

function main() {
  try {
    const options = parseArgs(process.argv.slice(2));

    if (options.help) {
      showHelp();
      process.exit(0);
    }

    if (options.dashboard || options.panel) {
      const result = renderDashboard(options);
      process.stdout.write(options.json ? `${JSON.stringify(result.data, null, 2)}\n` : result.text);
    } else {

View on GitHub (pinned to 8321021c54)