affaan-m/ECC · error · Error
Unknown option
Error message
Unknown option: ${arg} What it means
parseArgs in scripts/loop-status.js only recognizes a fixed set of CLI options; any argument not matching a known flag falls into the else branch and throws 'Unknown option: <arg>'. This is a strict allowlist parser: typos, renamed flags, or extra positional arguments are rejected rather than ignored.
Solutions
- Check the flag spelling against the accepted options in parseArgs (--watch, --watch-count, --watch-interval-seconds, --write-dir, --exit-code, --now, etc.) and fix the typo.
- Run `node scripts/loop-status.js --help` (or read the script header) to list valid flags.
- Remove any positional/extra arguments — the parser expects only known flags.
- If a flag was renamed in a recent update, migrate to the new flag name.
Example fix
// before node scripts/loop-status.js --watch-cout 5 // after node scripts/loop-status.js --watch-count 5
Defensive patterns
Strategy: validation
Validate before calling
const KNOWN = new Set(['--watch','--watch-count','--watch-interval-seconds','--write-dir','--exit-code','--now']);
const bad = args.filter(a => a.startsWith('--') && !KNOWN.has(a));
if (bad.length) throw new Error(`Unknown option(s): ${bad.join(', ')}`); Type guard
const isKnownFlag = (arg, known) => known.has(arg);
Try / catch
try { run(args); } catch (e) { if (e.message.startsWith('Unknown option:')) { console.error(`${e.message} — run with --help for valid flags`); process.exitCode = 2; } else throw e; } Prevention
- Keep a copy of the accepted flags in your wrapper scripts
- Lint CLI invocations in CI against the known flag set
- Avoid copying flags between different ECC scripts
When it happens
Trigger: Running `node scripts/loop-status.js --wathc` (typo), `--verbose` (unsupported flag), or passing a stray positional like `node scripts/loop-status.js foo`.
Common situations: Typo in a flag name, copying flags from a different script (e.g. memory.js flags like --once), old flags removed in a script update, or forgetting that the script takes no positional arguments.
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
- Unknown option
- requires a value.
- does not accept positional arguments.
- --exit-code with --watch requires --watch-count so the…
- must be a positive integer
AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16).
Data as JSON: /api/errors/28d068e902fe7423.
Report an issue: GitHub.
Appendix: source
Thrown at scripts/loop-status.js:121
index += 1;
} else if (arg === '--now') {
options.now = readValue(args, index, arg);
index += 1;
} else if (arg === '--exit-code') {
options.exitCode = true;
} else if (arg === '--watch') {
options.watch = true;
} else if (arg === '--watch-count') {
options.watchCount = readPositiveInteger(readValue(args, index, arg), arg);
index += 1;
} else if (arg === '--watch-interval-seconds') {
options.watchIntervalSeconds = readPositiveNumber(readValue(args, index, arg), arg);
index += 1;
} else if (arg === '--write-dir') {
options.writeDir = readValue(args, index, arg);
index += 1;
} else {
throw new Error(`Unknown option: ${arg}`);
}
}
if (options.exitCode && options.watch && options.watchCount === null) {
throw new Error('--exit-code with --watch requires --watch-count so the process can exit');
}
return options;
}
function normalizeOptions(options = {}) {
return {
...options,
bashTimeoutSeconds: options.bashTimeoutSeconds ?? DEFAULT_BASH_TIMEOUT_SECONDS,
exitCode: Boolean(options.exitCode),
limit: options.limit ?? DEFAULT_LIMIT,
transcriptPaths: options.transcriptPaths || [],
watch: Boolean(options.watch),View on GitHub (pinned to 8321021c54)