affaan-m/ECC · error · Error

Unknown argument: ${arg}

Error message

Unknown argument: ${arg}

What it means

Thrown by scripts/uninstall.js parseArgs when an argv token is not one of the recognized flags: --target, --dry-run, --json, --help, or -h. The uninstall parser is a strict allowlist and rejects any unknown option before consulting install-state files, preventing accidental removal triggered by a misunderstood flag.

Source

Thrown at scripts/uninstall.js:39

    dryRun: false,
    json: false,
    help: false,
  };

  for (let index = 0; index < args.length; index += 1) {
    const arg = args[index];

    if (arg === '--target') {
      parsed.targets.push(args[index + 1] || null);
      index += 1;
    } else if (arg === '--dry-run') {
      parsed.dryRun = true;
    } else if (arg === '--json') {
      parsed.json = true;
    } else if (arg === '--help' || arg === '-h') {
      parsed.help = true;
    } else {
      throw new Error(`Unknown argument: ${arg}`);
    }
  }

  return parsed;
}

function printHuman(result) {
  if (result.results.length === 0) {
    console.log('No ECC install-state files found for the current home/project context.');
    return;
  }

  console.log('Uninstall summary:\n');
  for (const entry of result.results) {
    console.log(`- ${entry.adapter.id}`);
    console.log(`  Status: ${entry.status.toUpperCase()}`);
    console.log(`  Install-state: ${entry.installStatePath}`);

View on GitHub (pinned to 01e15490f0)

Solutions

  1. Run `node scripts/uninstall.js --help` to see the accepted flags and the supported --target values.
  2. Correct the flag spelling (note it is --dry-run with a hyphen, not --dryrun).
  3. Remove the unsupported flag or replace it with the closest valid equivalent (--target scopes removal, --dry-run previews).

Example fix

// before
node scripts/uninstall.js --force

// after
node scripts/uninstall.js --target claude --dry-run
Defensive patterns

Strategy: validation

Validate before calling

const UNINSTALL_FLAGS = new Set(['--target', '--dry-run', '--json', '--help', '-h']);
function validateUninstallArgs(argv) {
  for (let i = 0; i < argv.length; i++) {
    const tok = argv[i];
    if (tok.startsWith('-') && !UNINSTALL_FLAGS.has(tok)) {
      throw new Error(`Unsupported uninstall.js flag: ${tok}`);
    }
    if (tok === '--target') i += 1; // skip value
  }
}

Prevention

When it happens

Trigger: Passing `node scripts/uninstall.js --force`, `--all`, `--purge`, or any flag not in the four-flag allowlist. Also triggered by flags from an older/newer ECC version whose uninstall surface differs.

Common situations: Users assuming uninstall supports a --force or --all flag common to other uninstallers; typos like `--dryrun` (correct is --dry-run); passing a global flag that belongs to a different ECC subcommand.

Related errors


AI-assisted analysis of affaan-m/ECC@01e15490f0 (2026-08-13). Data as JSON: /api/errors/052fecf802eca3b8. Report an issue: GitHub.