affaan-m/ECC · error · Error
Unknown argument: ${arg}
Error message
Unknown argument: ${arg} What it means
Thrown by parseArgs in scripts/observability-readiness.js when a token starts with `--` but matches none of the recognized flags (--format, --root, --help/-h). The parser is a strict allowlist: any unrecognized flag is rejected rather than silently ignored.
Source
Thrown at scripts/observability-readiness.js:68
}
if (arg.startsWith('--format=')) {
parsed.format = arg.slice('--format='.length).toLowerCase();
continue;
}
if (arg === '--root') {
parsed.root = path.resolve(readValue(args, index, arg));
index += 1;
continue;
}
if (arg.startsWith('--root=')) {
parsed.root = path.resolve(arg.slice('--root='.length));
continue;
}
throw new Error(`Unknown argument: ${arg}`);
}
if (!['text', 'json'].includes(parsed.format)) {
throw new Error(`Invalid format: ${parsed.format}. Use text or json.`);
}
return parsed;
}
function fileExists(rootDir, relativePath) {
return fs.existsSync(path.join(rootDir, relativePath));
}
function readText(rootDir, relativePath) {
try {
return fs.readFileSync(path.join(rootDir, relativePath), 'utf8');
} catch (_error) {
return '';View on GitHub (pinned to 01e15490f0)
Solutions
- Run `node scripts/observability-readiness.js --help` to see the accepted flags.
- Remove or correct the offending flag; this script only accepts --format, --root, and --help/-h.
- If you intended the richer dashboard flags, invoke operator-readiness-dashboard.js instead.
Example fix
// before node scripts/observability-readiness.js --json // after node scripts/observability-readiness.js --format json
Defensive patterns
Strategy: validation
Validate before calling
const OBS_FLAGS = new Set(['--format', '--root', '--help', '-h']);
function assertKnownFlags(argv) {
for (const a of argv) {
if (a.startsWith('--') && !a.startsWith('--format=') && !a.startsWith('--root=') && !OBS_FLAGS.has(a)) {
throw new Error(`Unsupported flag for observability-readiness: ${a}`);
}
}
} Prevention
- Do not carry flags over from operator-readiness-dashboard.js — the two scripts have different surfaces.
- Generate flags from a validated allowlist in your wrapper.
- Run `--help` after upgrades to refresh the known set.
When it happens
Trigger: Passing a flag from a different tool (e.g. `--output`, `--quiet`, `--verbose`); typos like `--frm` or `--rot`; using a flag that exists in operator-readiness-dashboard.js but not here (these are two separate scripts with different flag sets).
Common situations: Confusing this script's flags with those of the sibling operator-readiness-dashboard.js (which accepts --json, --markdown, --write, etc.); copy-pasting a command from documentation for a different ECC script; an agent guessing flag names.
Related errors
- ${flagName} requires a value
- Invalid format: ${parsed.format}. Use text or json.
- Unknown argument: ${arg}
- Unknown argument: ${arg}
- --timeout-ms must be a positive number
AI-assisted analysis of affaan-m/ECC@01e15490f0 (2026-08-13).
Data as JSON: /api/errors/d0100af1bbd58f56.
Report an issue: GitHub.