affaan-m/ECC · error · Error

Unknown argument

Error message

Unknown argument: ${arg}

What it means

Sentinel guard at the end of feedback.js parseArgs: only --json and --help/-h are recognized, so any other token passed to 'ecc feedback' throws here; it enforces that this diagnostics-free command accepts no extra flags.

Solutions

  1. Call as `ecc feedback` with at most --json and/or --help.
  2. Remove stray positional arguments from the invocation.
  3. Fix the typo in the calling command.

Example fix

// before
$ node scripts/feedback.js --verbose
Error: Unknown argument: --verbose
// after
$ node scripts/feedback.js --json
Defensive patterns

Strategy: validation

Validate before calling

const ALLOWED = new Set(['--json', '--help', '-h']);
const bad = process.argv.slice(2).filter(a => !ALLOWED.has(a));
if (bad.length) console.error(`Unsupported flags: ${bad.join(' ')}`);

Type guard

const isKnownFeedbackFlag = (arg) => ['--json','--help','-h'].includes(arg);

Try / catch

try {
  runFeedback(process.argv.slice(2));
} catch (err) {
  if (/^Unknown argument:/.test(err.message)) {
    console.error(`${err.message}\nUsage: feedback [--json] [--help]`);
    process.exit(1);
  }
  throw err;
}

Prevention

When it happens

Trigger: Running `node scripts/feedback.js --verbose`, `--file x`, or any unrecognized option; typos like `--jsn` or `-j` also trigger it since only exact matches are accepted.

Common situations: Typos in flags, assuming feedback.js supports flags from other ECC scripts (like github-coordination.js's larger flag set), or passing global-style options it does not implement.

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/9ddf3e70fb2b7002. Report an issue: GitHub.

Appendix: source

Thrown at scripts/feedback.js:27

  process.stdout.write(`
Usage: ecc feedback [--json] [--help|-h]

Print ECC's low-friction public feedback routes. This command never uploads
diagnostics or reads project files.
`);
}

function parseArgs(argv) {
  return argv.slice(2).reduce((parsed, arg) => {
    if (arg === '--json') {
      return { ...parsed, json: true };
    }

    if (arg === '--help' || arg === '-h') {
      return { ...parsed, help: true };
    }

    throw new Error(`Unknown argument: ${arg}`);
  }, { json: false, help: false });
}

function printHuman() {
  process.stdout.write([
    'ECC feedback',
    '',
    `Install or runtime problem:\n${FEEDBACK_ROUTES.problem}`,
    '',
    `Quick feedback (public GitHub issue):\n${FEEDBACK_ROUTES.feedback}`,
    '',
    `Feature idea:\n${FEEDBACK_ROUTES.feature}`,
    '',
    'ECC does not upload diagnostics or read project files. Redact sensitive information before posting publicly.',
    '',
  ].join('\n'));
}

View on GitHub (pinned to 8321021c54)