affaan-m/ECC · error · Error
Unknown argument: ${a}
Error message
Unknown argument: ${a} What it means
Thrown by proximity-tick's parseArgs else-branch when a token matched none of --help/-h, --dry-run, --json, --watch, --db, --state-db. The loop is a flat if/else chain with explicit value consumption (i += 1) for the value flags, so any unrecognized token — including a misspelled flag or a value whose flag was typo'd — lands here.
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 01e15490f0)
Solutions
- Run `--help` to see the five accepted flags (only --watch/--db/--state-db take values).
- Use the exact hyphenated forms: `--dry-run`, `--state-db`.
- Quote path arguments to --db/--state-db to avoid token splitting.
Example fix
# before node scripts/proximity-tick.js --dryrun --watch 30 # after node scripts/proximity-tick.js --dry-run --watch 30
Defensive patterns
Strategy: validation
Validate before calling
const PROXIMITY_FLAGS = new Set(['--help','-h','--dry-run','--json','--watch','--db','--state-db']);
function isProximityFlag(token) {
return PROXIMITY_FLAGS.has(token);
} Type guard
function isKnownProximityFlag(token) {
return PROXIMITY_FLAGS.has(token);
} Try / catch
try {
parseArgs(process.argv);
} catch (err) {
if (err.message.startsWith('Unknown argument')) {
console.error(`${err.message}. Accepted: --dry-run, --json, --watch <s>, --db <path>, --state-db <path>.`);
process.exit(2);
}
throw err;
} Prevention
- Use exact hyphenated forms: --dry-run, --state-db.
- Quote --db/--state-db paths to prevent token splitting.
- Run --help to confirm the flag set for this version.
When it happens
Trigger: A typo like `--dryrun` (no hyphen) or `--state-db`; a positional arg the script does not accept; a flag from another ECC script; value flags where the previous flag name was misspelled so the value is read as a new flag.
Common situations: User copies flags from a different control-pane script; version drift where a flag was renamed; shell expansion turning a path into multiple tokens.
Related errors
- --watch needs a positive seconds value
- Unknown argument: ${arg}
- Unknown argument: ${arg}
- --timeout-ms must be a positive number
- Invalid format: ${parsed.format}. Use text or json.
AI-assisted analysis of affaan-m/ECC@01e15490f0 (2026-08-13).
Data as JSON: /api/errors/67a7fe1aba813f81.
Report an issue: GitHub.