{"record":{"id":"7eb785641ee41177","repo":"Egonex-AI/Understand-Anything","slug":"a-repository-path-is-required","errorCode":null,"errorMessage":"A repository path is required","messagePattern":"A repository path is required","errorType":"validation","errorClass":"CliUsageError","httpStatus":null,"severity":"error","filePath":"scripts/lib/large-repo-benchmark.mjs","lineNumber":247,"sourceCode":"      concurrency = parseConcurrency(raw);\n      i += 1;\n      continue;\n    }\n    if (arg.startsWith('--concurrency=')) {\n      concurrency = parseConcurrency(arg.slice('--concurrency='.length));\n      continue;\n    }\n    if (arg.startsWith('-')) {\n      throw new CliUsageError(`Unknown option: ${arg}`);\n    }\n    if (repoValue) {\n      throw new CliUsageError(`Unexpected positional argument: ${arg}`);\n    }\n    repoValue = arg;\n  }\n\n  if (help) return { help: true };\n  if (!repoValue) throw new CliUsageError('A repository path is required');\n  if (outputValue === null || outputValue.trim() === '') {\n    throw new CliUsageError('--output is required and must be non-empty');\n  }\n  if (!Number.isInteger(concurrency) || concurrency < 1 || concurrency > 32) {\n    throw new CliUsageError('--concurrency must be an integer between 1 and 32');\n  }\n\n  const repoRoot = resolve(cwd, repoValue);\n  if (!existsSync(repoRoot)) {\n    throw new CliUsageError(`Repository path does not exist: ${repoValue}`);\n  }\n  if (!statSync(repoRoot).isDirectory()) {\n    throw new CliUsageError(`Repository path is not a directory: ${repoValue}`);\n  }\n\n  const outputPath = resolve(cwd, outputValue);\n  const markdownPath = resolve(\n    cwd,","sourceCodeStart":229,"sourceCodeEnd":265,"githubUrl":"https://github.com/Egonex-AI/Understand-Anything/blob/32944829e7a63a9fa9c55d811d7f98a9530c6a6a/scripts/lib/large-repo-benchmark.mjs#L229-L265","documentation":"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.","triggerScenarios":"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).","commonSituations":"Assuming the repo defaults to the current directory; forgetting the required positional; a wrapper script that conditionally includes the repo and omitted it.","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."],"exampleFix":"# before\nnode benchmark-large-repo.mjs --output out.json\n# after\nnode benchmark-large-repo.mjs . --output out.json","handlingStrategy":"validation","validationCode":"const positionals = argv.filter(a => !a.startsWith('-'));\nif (positionals.length === 0 && !argv.some(a => a.startsWith('--repo'))) { /* missing repo */ }","typeGuard":null,"tryCatchPattern":"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; }","preventionTips":["Always supply the repo positional or --repo.","In CI wrappers, assert the repo path is set before invoking the command."],"tags":["benchmark","cli","argument-parsing"],"backgroundTag":null,"analyzedSha":"32944829e7a63a9fa9c55d811d7f98a9530c6a6a","analyzedAt":"2026-08-12T10:25:44.261Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}