{"record":{"id":"9b3d92d9e3defebc","repo":"stablyai/orca","slug":"arg-requires-a-path-9b3d92","errorCode":null,"errorMessage":"${arg} requires a path","messagePattern":"(.+?) requires a path","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"config/scripts/run-terminal-scale-perf-report-gate.mjs","lineNumber":22,"sourceCode":"import { dirname, join } from 'node:path'\n\nconst DEFAULT_REPORT_PATH = 'test-results/terminal-scale-perf-report.json'\nconst DEFAULT_HTML_REPORT_PATH = 'test-results/terminal-perf-impact-report.html'\n\nexport function parseReportGateArgs(argv, env = process.env) {\n  const forwardedArgs = [...argv]\n  if (forwardedArgs[0] === '--') {\n    forwardedArgs.shift()\n  }\n\n  let reportPath = env.ORCA_E2E_TERMINAL_PERF_REPORT_PATH || DEFAULT_REPORT_PATH\n  const passthroughArgs = []\n  for (let index = 0; index < forwardedArgs.length; index += 1) {\n    const arg = forwardedArgs[index]\n    if (arg === '--report' || arg === '--report-path' || arg === '--output') {\n      const next = forwardedArgs[index + 1]\n      if (!next || next.startsWith('-')) {\n        throw new Error(`${arg} requires a path`)\n      }\n      reportPath = next\n      index += 1\n      continue\n    }\n    if (\n      arg.startsWith('--report=') ||\n      arg.startsWith('--report-path=') ||\n      arg.startsWith('--output=')\n    ) {\n      reportPath = arg.slice(arg.indexOf('=') + 1)\n      continue\n    }\n    if (arg === '--reporter' || arg.startsWith('--reporter=')) {\n      throw new Error('test:e2e:terminal-perf:scale:report always uses --reporter=json')\n    }\n    passthroughArgs.push(arg)\n  }","sourceCodeStart":4,"sourceCodeEnd":40,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/config/scripts/run-terminal-scale-perf-report-gate.mjs#L4-L40","documentation":"The gate script parses forwarded args to find --report/--report-path/--output and capture the JSON report path. Each of these expects a following path token; if the next arg is missing or starts with '-' (another flag), it throws. This prevents silently writing the report to an unintended/default location or to a flag-named file.","triggerScenarios":"Passing `--report` as the last arg, or `--report --something`, so the parser sees no path value where one is required.","commonSituations":"A developer appends --report without a value expecting a default; an arg-quoting bug collapses the path; copy-pasting a command and dropping the trailing path.","solutions":["Supply an explicit path: --report ./test-results/perf-report.json.","If you wanted the default location, omit --report entirely (env ORCA_E2E_TERMINAL_PERF_REPORT_PATH or DEFAULT_REPORT_PATH applies).","Quote paths containing spaces and ensure the path does not start with '-' (rename or use an absolute path)."],"exampleFix":"// before\npnpm run test:e2e:terminal-perf:scale:report -- --report\n// after\npnpm run test:e2e:terminal-perf:scale:report -- --report ./test-results/perf-report.json","handlingStrategy":"validation","validationCode":"for (let i = 0; i < args.length; i++) {\n  const a = args[i]\n  if (a === '--report' || a === '--report-path' || a === '--output') {\n    const next = args[i + 1]\n    if (!next || next.startsWith('-')) {\n      console.error(`${a} requires a path argument`); process.exit(2)\n    }\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass an explicit path with --report, or omit it to use the default.","Validate the next token does not start with '-' before consuming it.","Quote paths with spaces and avoid leading-dash path names."],"tags":["cli","argv","validation","perf-report"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}