affaan-m/ECC · error
Unknown argument
Error message
Unknown argument: ${a} What it means
parseArgs in scripts/proximity-tick.js throws this error when a command-line token does not match any of its recognized flags (--help, --dry-run, --json, --watch, --db, --state-db, etc.). The allowlist parser rejects unknown flags instead of ignoring them, catching typos and cross-script flag mistakes.
Solutions
- Run with --help/-h to see supported flags
- Fix the flag spelling to one of the recognized options
- Remove unsupported positional arguments
- Use space-separated flag values (e.g. --db path) if equals form isn't supported
Example fix
// before node scripts/proximity-tick.js --interval 10 // after node scripts/proximity-tick.js --watch 10
Defensive patterns
Strategy: validation
Validate before calling
const KNOWN = new Set(['--help','-h','--dry-run','--json','--watch','--db','--state-db']);
function findUnknownFlags(argv) {
return argv.slice(2).filter(a => a.startsWith('--') && !KNOWN.has(a));
} Try / catch
try {
await main(process.argv);
} catch (e) {
if (e.message.startsWith('Unknown argument:')) {
console.error(`${e.message} — see --help for supported flags`);
process.exitCode = 2;
} else throw e;
} Prevention
- Run with --help/-h to confirm flag names before use
- Avoid porting flags from sibling scripts without checking
- Use space-separated values for --db/--state-db/--watch
- Add a dry parse of argv in wrapper scripts to catch typos early
When it happens
Trigger: Passing an unsupported or misspelled flag such as `--interval`, `--verbose`, `--db=` (equals form if unsupported), or a stray positional argument.
Common situations: Reusing flags from other tick/audit scripts; typos like `--state_db`; passing positional file paths the script doesn't accept; assuming equals-style syntax is supported.
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/67a7fe1aba813f81.
Report an issue: GitHub.
Appendix: source
Thrown at scripts/proximity-tick.js:41
const parsed = { watchSec: 0, dryRun: false, json: false, help: false, dbPath: null, stateDbPath: null };
for (let i = 0; i < args.length; i += 1) {
const a = args[i];
if (a === '--help' || a === '-h') parsed.help = true;
else if (a === '--dry-run') parsed.dryRun = true;
else if (a === '--json') parsed.json = true;
else if (a === '--watch') {
const v = Number.parseInt(args[i + 1], 10);
if (!Number.isInteger(v) || v <= 0) throw new Error('--watch needs a positive seconds value');
parsed.watchSec = v;
i += 1;
} else if (a === '--db') {
parsed.dbPath = args[i + 1];
i += 1;
} else if (a === '--state-db') {
parsed.stateDbPath = args[i + 1];
i += 1;
} else {
throw new Error(`Unknown argument: ${a}`);
}
}
return parsed;
}
function showHelp() {
console.log(
[
'Usage: node scripts/proximity-tick.js [--watch <seconds>] [--dry-run] [--json] [--db <path>] [--state-db <path>]',
'',
'Scan agent proximity from the control-pane state and steer/transmit by sending',
'internal session-to-session messages. --dry-run sends nothing; --watch loops.'
].join('\n')
);
}
function report(tick, json) {
if (json) {View on GitHub (pinned to 8321021c54)