affaan-m/ECC · error
Unknown argument
Error message
Unknown argument: ${arg} What it means
parseArgs in scripts/status.js matches each argv token against a whitelist of flags (--limit, --help/-h, etc.). Any unrecognized token hits the final else branch, which throws "Unknown argument: <arg>". The script deliberately rejects rather than ignores unknown flags so mistakes surface immediately.
Solutions
- Run `node scripts/status.js --help` to see the supported flag list.
- Fix the flag spelling (e.g. --json, --markdown, --db, --write, --limit).
- Remove arguments intended for a different script.
Example fix
// before node scripts/status.js --form json // after node scripts/status.js --json
Defensive patterns
Strategy: validation
Validate before calling
const SUPPORTED = new Set(['--json', '--markdown', '--db', '--write', '--limit', '--help', '-h']);
const unknown = argv.filter(a => a.startsWith('--') && !SUPPORTED.has(a) && a !== '-h');
if (unknown.length) console.error('Unsupported flags:', unknown); Try / catch
try {
runStatus(argv);
} catch (e) {
if (e.message.startsWith('Unknown argument')) {
console.error(`${e.message}. See: node scripts/status.js --help`);
process.exitCode = 1;
} else throw e;
} Prevention
- Run scripts/status.js --help to enumerate valid flags before composing commands.
- Verify flag names against this script, not other ECC scripts.
- Lint wrapper scripts that interpolate flag names.
When it happens
Trigger: Running `node scripts/status.js --form json` (typo for --format or a nonexistent flag), or passing options belonging to other ECC scripts like --panel to status.js.
Common situations: Typos in flag names; reusing command lines across different ECC scripts; stale documentation or shell aliases from an older script version.
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/754f644d15e370dd.
Report an issue: GitHub.
Appendix: source
Thrown at scripts/status.js:58
if (arg === '--db') {
parsed.dbPath = args[index + 1] || null;
index += 1;
} else if (arg === '--json') {
parsed.json = true;
} else if (arg === '--markdown') {
parsed.markdown = true;
} else if (arg === '--exit-code') {
parsed.exitCode = true;
} else if (arg === '--write') {
parsed.writePath = args[index + 1] || null;
index += 1;
} else if (arg === '--limit') {
parsed.limit = args[index + 1] || null;
index += 1;
} else if (arg === '--help' || arg === '-h') {
parsed.help = true;
} else {
throw new Error(`Unknown argument: ${arg}`);
}
}
if (parsed.json && parsed.markdown) {
throw new Error('Choose only one output format: --json or --markdown');
}
if (args.includes('--db') && !parsed.dbPath) {
throw new Error('Missing value for --db');
}
if (args.includes('--write') && !parsed.writePath) {
throw new Error('Missing value for --write');
}
if (args.includes('--limit') && !parsed.limit) {
throw new Error('Missing value for --limit');
}View on GitHub (pinned to 8321021c54)