{"record":{"id":"d54435d1e11e0a6c","repo":"stablyai/orca","slug":"json-output-requires-a-path","errorCode":null,"errorMessage":"--json-output requires a path","messagePattern":"--json-output requires a path","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"config/scripts/compare-benchmark-artifacts.mjs","lineNumber":67,"sourceCode":"      }\n      continue\n    }\n    throw new Error(USAGE)\n  }\n\n  if (!parsed.baselinePath) {\n    throw new Error(USAGE)\n  }\n  if (!parsed.candidatePath) {\n    throw new Error(USAGE)\n  }\n  return parsed\n}\n\nfunction readRequiredValue(args, index, message) {\n  const value = args[index]\n  if (value == null || value.startsWith('--')) {\n    throw new Error(message)\n  }\n  return value\n}\n\nexport function readBenchmarkArtifact(path) {\n  return JSON.parse(readFileSync(path, 'utf8'))\n}\n\nexport function normalizeBenchmarkArtifact(path, artifact = readBenchmarkArtifact(path)) {\n  if (artifact?.summaryMedianMs != null) {\n    return normalizeNumericObject(path, artifact, 'startup', artifact.summaryMedianMs, () => 'ms')\n  }\n  if (artifact?.summaryMedian != null) {\n    return normalizeNumericObject(path, artifact, 'daemon', artifact.summaryMedian, (key) =>\n      key.endsWith('Count') || key.endsWith('After') ? 'count' : 'ms'\n    )\n  }\n  if (artifact?.suites != null) {","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/config/scripts/compare-benchmark-artifacts.mjs#L49-L85","documentation":"Thrown by readRequiredValue when --json-output is followed by a null or flag-like token. --json-output writes the structured comparison object and, when present, must take a value (compare-benchmark-artifacts.mjs:36-38, 64-69).","triggerScenarios":"Passing '--json-output' as the last token; passing '--json-output --higher-is-better key'; an empty variable for the JSON path.","commonSituations":"A reporting pipeline that conditionally emits JSON but the path variable is unset on a branch; flag-ordering mistakes; partial edit of a template command.","solutions":["Provide a valid file path token after --json-output, or remove the flag to skip JSON output.","Ensure the path's parent directory can be created (mkdirSync recursive is called on dirname)."],"exampleFix":"// before\nparseBenchmarkComparisonArgs(['--baseline','b.json','--candidate','c.json','--json-output'])\n// after\nparseBenchmarkComparisonArgs(['--baseline','b.json','--candidate','c.json','--json-output','reports/cmp.json'])","handlingStrategy":"validation","validationCode":"const i = argv.indexOf('--json-output')\nif (i !== -1 && (i + 1 >= argv.length || argv[i + 1].startsWith('--'))) {\n  throw new Error('--json-output needs a path')\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only add --json-output when the JSON path is determined and non-empty.","Ensure the parent directory is creatable (the script runs mkdirSync recursive on dirname)."],"tags":["cli","argument-validation","benchmark"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}