Egonex-AI/Understand-Anything · error · CliUsageError
Unknown option: ${arg}
Error message
Unknown option: ${arg} What it means
CliUsageError thrown by parseArgs when an argument token starts with '-' but does not match any recognised flag (--help/-h, --keep-artifacts, --repo, --output/-o, --label, --concurrency, and their =-forms). It catches typos and unsupported options early with a clear message naming the offending token.
Source
Thrown at scripts/lib/large-repo-benchmark.mjs:238
i += 1;
continue;
}
if (arg.startsWith('--label=')) {
label = arg.slice('--label='.length);
continue;
}
if (arg === '--concurrency') {
const raw = takeValue(argv, i, '--concurrency');
concurrency = parseConcurrency(raw);
i += 1;
continue;
}
if (arg.startsWith('--concurrency=')) {
concurrency = parseConcurrency(arg.slice('--concurrency='.length));
continue;
}
if (arg.startsWith('-')) {
throw new CliUsageError(`Unknown option: ${arg}`);
}
if (repoValue) {
throw new CliUsageError(`Unexpected positional argument: ${arg}`);
}
repoValue = arg;
}
if (help) return { help: true };
if (!repoValue) throw new CliUsageError('A repository path is required');
if (outputValue === null || outputValue.trim() === '') {
throw new CliUsageError('--output is required and must be non-empty');
}
if (!Number.isInteger(concurrency) || concurrency < 1 || concurrency > 32) {
throw new CliUsageError('--concurrency must be an integer between 1 and 32');
}
const repoRoot = resolve(cwd, repoValue);
if (!existsSync(repoRoot)) {View on GitHub (pinned to 32944829e7)
Solutions
- Run with --help to see the accepted flags and their exact spelling.
- Correct the flag name (e.g. --ouput -> --output).
- Remove the unsupported option if it is not needed for this run.
- If you expect the option to be supported, upgrade the tool to a version that provides it.
Example fix
# before node benchmark-large-repo.mjs myrepo --ouput out.json # after node benchmark-large-repo.mjs myrepo --output out.json
Defensive patterns
Strategy: validation
Validate before calling
const KNOWN = new Set(['--help','-h','--keep-artifacts','--repo','--output','-o','--label','--concurrency']);
function isKnownFlag(arg: string): boolean {
return KNOWN.has(arg) || KNOWN.has(arg.split('=')[0]);
} Try / catch
try { const opts = parseArgs(argv); } catch (e) { if ((e as Error).name === 'CliUsageError') { console.error(e.message); console.error(helpText()); process.exit(2); } throw e; } Prevention
- Run with --help to confirm exact flag spellings.
- Validate flags against a known set before invoking parseArgs in wrappers.
When it happens
Trigger: Passing a misspelled flag like '--ouput', a short form that does not exist like '-x', a single-dash long option like '-repo', or any future/unsupported option.
Common situations: Typos in flag names; using a flag from a different version of the tool; copy-pasting options from documentation for a different command; confusion between single-dash and double-dash conventions.
Related errors
- ${flag} requires a value
- Unexpected positional argument: ${arg}
- A repository path is required
- --output is required and must be non-empty
- --concurrency must be an integer between 1 and 32
AI-assisted analysis of Egonex-AI/Understand-Anything@32944829e7 (2026-08-12).
Data as JSON: /api/errors/6790e92d29233f4a.
Report an issue: GitHub.