affaan-m/ECC · error · Error

--all-harnesses and --harness are mutually exclusive.

Error message

--all-harnesses and --harness are mutually exclusive.

What it means

parseArgs() in the guided install script enforces that the --all-harnesses shortcut cannot be combined with explicit --harness selections. The two options describe the harness set in incompatible ways (all vs. a subset), so the script rejects the combination rather than guessing intent. This is a fail-fast CLI contract check that runs immediately after argument collection.

Solutions

  1. Remove --all-harnesses if you want specific harnesses, keeping only the --harness flags.
  2. Remove all --harness flags if you actually want every harness installed.
  3. If the intent is conditional in a wrapper script, branch: use either --all-harnesses or the explicit list, never both.

Example fix

// before
node scripts/install-guided.js --all-harnesses --harness claude --harness codex
// after
node scripts/install-guided.js --harness claude --harness codex
Defensive patterns

Strategy: validation

Validate before calling

if (allHarnesses && harnessList.length > 0) { throw new Error('Use either --all-harnesses or --harness, not both'); }

Type guard

const hasConflict = (opts) => Boolean(opts.allHarnesses) && Array.isArray(opts.harnesses) && opts.harnesses.length > 0;

Prevention

When it happens

Trigger: Invoking `node scripts/install-guided.js --all-harnesses --harness claude` (or any --harness repeat) such that options.allHarnesses is truthy while options.harnesses has length > 0 when parseArgs returns.

Common situations: Shell scripts that append --all-harnesses to a base command that already lists harnesses; users copying an 'install everything' snippet and adding a specific harness; CI templates parameterized with a harness list that collides with an --all-harnesses default.

Understand the failure class

Background: "mutually exclusive" flag errors: what "can't supply both nx and xx", "--raw is not compatible with -i" and "cannot be used with" mean, and how to fix them — this error's family across 29 libraries.

Related errors


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

Appendix: source

Thrown at scripts/install-guided.js:107

        ? { ...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): `
      : 'Choose one option: ';
    const answer = (await terminal.question(question)).trim().toLowerCase();
    if (!answer && defaultValue) return defaultValue;
    const numeric = /^\d+$/.test(answer) ? values[Number(answer) - 1] : undefined;

View on GitHub (pinned to 8321021c54)