Egonex-AI/Understand-Anything · error · CliUsageError
A repository path is required
Error message
A repository path is required
What it means
CliUsageError thrown by parseArgs after the loop completes if no repository path was supplied (repoValue still null). Help short-circuits earlier, so this fires only when the user provided options but omitted the required positional repo.
Source
Thrown at scripts/lib/large-repo-benchmark.mjs:247
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)) {
throw new CliUsageError(`Repository path does not exist: ${repoValue}`);
}
if (!statSync(repoRoot).isDirectory()) {
throw new CliUsageError(`Repository path is not a directory: ${repoValue}`);
}
const outputPath = resolve(cwd, outputValue);
const markdownPath = resolve(
cwd,View on GitHub (pinned to 32944829e7)
Solutions
- Add the repository path as a positional or via --repo <path>.
- If you intended the current directory, pass '.' explicitly.
- Run with --help to confirm the required positional.
- Ensure any wrapper/CI script always supplies the repo path.
Example fix
# before node benchmark-large-repo.mjs --output out.json # after node benchmark-large-repo.mjs . --output out.json
Defensive patterns
Strategy: validation
Validate before calling
const positionals = argv.filter(a => !a.startsWith('-'));
if (positionals.length === 0 && !argv.some(a => a.startsWith('--repo'))) { /* missing repo */ } 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
- Always supply the repo positional or --repo.
- In CI wrappers, assert the repo path is set before invoking the command.
When it happens
Trigger: Running the command with only flags (e.g. --output ...) and no repo path; passing only --help is fine because it returns first; providing --repo= with an empty value also leaves repoValue as the empty string (which is truthy as a string but would fail later existence checks).
Common situations: Assuming the repo defaults to the current directory; forgetting the required positional; a wrapper script that conditionally includes the repo and omitted it.
Related errors
- ${flag} requires a value
- Unknown option: ${arg}
- Unexpected positional argument: ${arg}
- --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/7eb785641ee41177.
Report an issue: GitHub.