affaan-m/ECC · error · Error

Unknown argument. Run guided install with --help to see…

Error message

Unknown argument. Run guided install with --help to see valid options.

What it means

parseArgs in scripts/install-guided.js throws this when an argument is not one of the recognized flags (--harness, --all-harnesses, --dry-run, --json, --help/-h, and the known value flags). The message directs users to --help, making unknown flags fail fast.

Solutions

  1. Run `node scripts/install-guided.js --help` to list valid options
  2. Correct the flag spelling (e.g. --dry-run, --all-harnesses, --harness)
  3. Remove flags not supported by this installer (e.g. -y, --force)
  4. If automating, pin the installer version so flags match the script

Example fix

// before
node scripts/install-guided.js --force
// after
node scripts/install-guided.js --all-harnesses --dry-run
Defensive patterns

Strategy: validation

Validate before calling

const VALID = new Set(['--harness', '--all-harnesses', '--dry-run', '--json', '--help', '-h']);
const unknown = rawArgv.filter(a => a.startsWith('-') && !VALID.has(a));
if (unknown.length) throw new Error(`Unknown argument: ${unknown.join(', ')}`);

Try / catch

try {
  parseArgs(rawArgv);
} catch (err) {
  if (err.message.startsWith('Unknown argument.')) {
    console.error(`${err.message}\nRun: node scripts/install-guided.js --help`);
    process.exit(2);
  }
  throw err;
}

Prevention

When it happens

Trigger: Running `node scripts/install-guided.js --harlesson`, a positional word like `install`, or a flag from a different tool (`-y`, `--force`) that this CLI does not define.

Common situations: Typoed flags, muscle-memory flags from npm/other CLIs, scripting with flags from an older or newer version of the installer.

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/442dfc8b5e49ca4a. Report an issue: GitHub.

Appendix: source

Thrown at scripts/install-guided.js:103

        throw new Error(`Value for ${argument} is too long.`);
      }
      const key = valueFlags.get(argument);
      options = key === 'harnesses'
        ? { ...options, harnesses: [...options.harnesses, value] }
        : { ...options, [key]: value };
      index += 1;
    } else if (argument === '--all-harnesses') {
      options = { ...options, allHarnesses: true };
    } else if (argument === '--yes' || argument === '-y') {
      options = { ...options, yes: true };
    } else if (argument === '--dry-run') {
      options = { ...options, dryRun: true };
    } else if (argument === '--json') {
      options = { ...options, json: true };
    } else if (argument === '--help' || argument === '-h') {
      options = { ...options, help: true };
    } else {
      throw new Error('Unknown argument. Run guided install with --help to see valid options.');
    }
  }
  if (options.allHarnesses && options.harnesses.length > 0) {
    throw new Error('--all-harnesses and --harness are mutually exclusive.');
  }
  return options;
}

function choicesText(values) {
  return values.join('|');
}

async function askChoice(terminal, output, prompt, values, defaultValue) {
  output.write(`\n${prompt}\n`);
  values.forEach((value, index) => output.write(`  ${index + 1}. ${value}\n`));
  while (true) {
    const question = defaultValue
      ? `Choose [Recommended: ${defaultValue}] (one option only): `

View on GitHub (pinned to 8321021c54)