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
- Run `node scripts/uninstall.js --help` to see the accepted flags and the supported --target values.
- Correct the flag spelling (note it is --dry-run with a hyphen, not --dryrun).
- 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
- Remember uninstall.js only has four real flags; there is no --force or --all.
- Use --dry-run first to preview removals before a real run.
- Validate --target values against SUPPORTED_INSTALL_TARGETS from lib/install-manifests.js.
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
- ${label} must be a positive integer
- Unknown install target: ${parsed.target}. Expected one of ${
- Invalid ${flagName}: ${value}
- Invalid format: ${parsed.format}. Use text, json, or markdow
- --write requires --json, --markdown, or --format json|markdo
AI-assisted analysis of affaan-m/ECC@01e15490f0 (2026-08-13).
Data as JSON: /api/errors/052fecf802eca3b8.
Report an issue: GitHub.