affaan-m/ECC · warning
Unknown argument: ${arg}
Error message
Unknown argument: ${arg} What it means
The list-installed.js CLI parser only recognizes --target <name>, --json, and --help/-h; every other token hits the else branch and throws `Unknown argument: <arg>`. It is a strict allowlist, so typos, pluralized flags, and flags that belong to a different script all surface here. There is no positional argument support.
Source
Thrown at scripts/list-installed.js:35
const args = argv.slice(2);
const parsed = {
targets: [],
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 === '--json') {
parsed.json = true;
} else if (arg === '--help' || arg === '-h') {
parsed.help = true;
} else {
throw new Error(`Unknown argument: ${arg}`);
}
}
return parsed;
}
function printHuman(records) {
if (records.length === 0) {
console.log('No ECC install-state files found for the current home/project context.');
return;
}
console.log('Installed ECC targets:\n');
for (const record of records) {
if (record.error) {
console.log(`- ${record.adapter.id}: INVALID (${record.error})`);
continue;
}View on GitHub (pinned to 01e15490f0)
Solutions
- Run `node scripts/list-installed.js --help` and use only the flags shown.
- If you meant a target filter, use `--target <id>` (singular) and a value from SUPPORTED_INSTALL_TARGETS.
- Remove any positional or unrecognized flag; this script takes no positionals.
- If you need JSON output, combine exactly `--json` with optional `--target <id>`.
Example fix
# before node scripts/list-installed.js --targets claude-code --json # after node scripts/list-installed.js --target claude-code --json
Defensive patterns
Strategy: validation
Validate before calling
// Validate args before invoking the script.
const ALLOWED = new Set(['--target', '--json', '--help', '-h']);
function validateListInstalledArgs(argv) {
for (let i = 0; i < argv.length; i++) {
const a = argv[i];
if (!ALLOWED.has(a)) throw new Error(`Unknown argument: ${a}`);
if (a === '--target' && (i === argv.length - 1 || argv[i + 1].startsWith('--'))) {
throw new Error('--target requires a value');
}
}
} Try / catch
try { parseArgs(process.argv); }
catch (err) { if (/Unknown argument/.test(err.message)) { showHelp(2); } else throw err; } Prevention
- Always run `--help` first when unsure of supported flags.
- Use a wrapper that filters args through an allowlist.
- Remember list-installed takes NO positionals and only --target/--json.
When it happens
Trigger: Passing `--targets` (plural) instead of `--target`. Passing `--output`, `--format`, `--verbose`, or any flag from another ECC script. Leading positional like a target id. A stray value left after --target when its value was missing.
Common situations: Copying a command from memory and using the wrong flag name. Mixing up list-installed flags with install/uninstall script flags. A shell alias injecting extra args.
Related errors
- ${flagName} requires a value
- Unknown option: ${arg}
- ${argument} requires a value.
- Unknown option: ${argument}
- ${command} does not accept positional arguments.
AI-assisted analysis of affaan-m/ECC@01e15490f0 (2026-08-13).
Data as JSON: /api/errors/4b9619affb621437.
Report an issue: GitHub.