Egonex-AI/Understand-Anything · error · CliUsageError

Repository path does not exist: ${repoValue}

Error message

Repository path does not exist: ${repoValue}

What it means

CliUsageError thrown by parseArgs when the resolved repository path (resolved relative to cwd) does not exist on the filesystem. This runs after argument validation, so all required args are present; the failure is purely that the path is not present.

Source

Thrown at scripts/lib/large-repo-benchmark.mjs:257

    }
    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,
    outputPath.toLowerCase().endsWith('.json')
      ? `${outputPath.slice(0, -'.json'.length)}.md`
      : `${outputPath}.md`,
  );
  if (isPathInsideOrEqual(repoRoot, outputPath)) {
    throw new CliUsageError('--output must be outside the subject repository');
  }
  if (isPathInsideOrEqual(repoRoot, markdownPath)) {
    throw new CliUsageError('Markdown report path must be outside the subject repository');
  }

View on GitHub (pinned to 32944829e7)

Solutions

  1. Verify the path is correct and the repository is cloned locally.
  2. Use an absolute path to avoid cwd ambiguity.
  3. Clone the repository first if it does not yet exist.
  4. Confirm the cwd the command runs from.

Example fix

# before
node benchmark-large-repo.mjs ./nonexistent --output out.json
# after
node benchmark-large-repo.mjs /abs/path/to/repo --output out.json
Defensive patterns

Strategy: validation

Validate before calling

import { existsSync } from 'node:fs';
if (!existsSync(resolve(cwd, repoValue))) { /* reject early */ }

Try / catch

try { const opts = parseArgs(argv); } catch (e) { if ((e as Error).name === 'CliUsageError') { console.error(e.message); process.exit(2); } throw e; }

Prevention

When it happens

Trigger: Typo in the repo path; a relative path resolved against an unexpected cwd; the repo has not been cloned yet; the path points to a remote URL instead of a local directory.

Common situations: Running from a different working directory than expected; a typo; referencing a repository that was never cloned or was since removed; passing a git URL where a local path is required.

Related errors


AI-assisted analysis of Egonex-AI/Understand-Anything@32944829e7 (2026-08-12). Data as JSON: /api/errors/21121da24ca26d39. Report an issue: GitHub.