{"record":{"id":"1b1534bc34b30433","repo":"Egonex-AI/Understand-Anything","slug":"benchmark-report-files-must-share-a-directory","errorCode":null,"errorMessage":"Benchmark report files must share a directory","messagePattern":"Benchmark report files must share a directory","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/lib/large-repo-benchmark.mjs","lineNumber":842,"sourceCode":"      recovery.restoreFailures += 1;\n    }\n  } else if (!entry.hadOriginal && entry.installAttempted) {\n    if (!tryRemove(entry.targetPath, fileSystem)) {\n      recovery.rollbackRemoveFailures += 1;\n    }\n  }\n}\n\nexport function reportPairLockPath(outputPath, markdownPath) {\n  const outputDirectory = canonicalizePhysicalPath(dirname(outputPath));\n  const markdownDirectory = canonicalizePhysicalPath(dirname(markdownPath));\n  const normalizePairPath = (pathValue) =>\n    process.platform === 'win32' ? pathValue.toLowerCase() : pathValue;\n  if (\n    normalizePairPath(outputDirectory) !==\n    normalizePairPath(markdownDirectory)\n  ) {\n    throw new Error('Benchmark report files must share a directory');\n  }\n  const normalizedOutputPath = normalizePairPath(\n    canonicalizePhysicalPath(outputPath),\n  );\n  const normalizedMarkdownPath = normalizePairPath(\n    canonicalizePhysicalPath(markdownPath),\n  );\n  const pairKey = createHash('sha256')\n    .update(normalizedOutputPath)\n    .update('\\0')\n    .update(normalizedMarkdownPath)\n    .digest('hex')\n    .slice(0, 24);\n  return join(resolve(dirname(outputPath)), `.ua-report-pair-${pairKey}.lock`);\n}\n\nfunction stageReportEntry(entry, fileSystem) {\n  let descriptor;","sourceCodeStart":824,"sourceCodeEnd":860,"githubUrl":"https://github.com/Egonex-AI/Understand-Anything/blob/32944829e7a63a9fa9c55d811d7f98a9530c6a6a/scripts/lib/large-repo-benchmark.mjs#L824-L860","documentation":"Thrown by reportPairLockPath before the report transaction begins. The atomic delivery design writes the JSON report and the Markdown report as a pair in one directory, using a single advisory lock file whose key is derived from the directory. For the lock to be meaningful and for the rename-based install step to stay within one filesystem, both target files must live in the same physical directory (case-insensitively compared on win32).","triggerScenarios":"deliverBenchmarkReports is invoked with outputPath and markdownPath whose dirname values differ after canonicalizePhysicalPath (realpath) and win32 lowercasing. For example --output ./out/a.json --markdown ./other/b.md, or one path symlinked such that realpath resolves to a different directory than the other.","commonSituations":"User supplies --output and --markdown in different folders by mistake. One path goes through a symlink that realpath resolves elsewhere. Mixing an absolute path for one and a relative path for the other that land in different cwd-relative dirs. Windows case differences (Out vs out) that the lowercasing does reconcile, but genuine different directories do not.","solutions":["Put both report files in the same directory: --output ./reports/bench.json --markdown ./reports/bench.md.","If you need them in different locations, run the benchmark twice or copy one file after delivery instead of passing divergent paths.","Resolve symlinks with realpath before passing paths, since the comparison canonicalizes through realpath — a symlink that points outside the shared dir will trigger this."],"exampleFix":"// before — different directories\n--output ./out/bench.json --markdown ./docs/bench.md\n\n// after — same directory\n--output ./reports/bench.json --markdown ./reports/bench.md","handlingStrategy":"validation","validationCode":"import { realpathSync } from 'node:fs';\nimport { dirname } from 'node:path';\nfunction ensureReportPairSharesDir(outputPath, markdownPath) {\n  const norm = (p) => process.platform === 'win32'\n    ? realpathSync(dirname(p)).toLowerCase()\n    : realpathSync(dirname(p));\n  if (norm(outputPath) !== norm(markdownPath)) {\n    throw new Error('output and markdown must share one physical directory');\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  deliverBenchmarkReports(opts);\n} catch (e) {\n  if (/must share a directory/.test(e.message)) {\n    console.error('Pass --output and --markdown in the same directory.');\n  }\n  throw e;\n}","preventionTips":["Keep --output and --markdown in the same folder.","Resolve symlinks with realpath before passing paths, since the comparison canonicalizes them.","If you need separate locations, copy the file after a successful delivery rather than passing divergent paths."],"tags":["benchmark","filesystem","report-delivery","configuration","transaction"],"backgroundTag":null,"analyzedSha":"32944829e7a63a9fa9c55d811d7f98a9530c6a6a","analyzedAt":"2026-08-12T10:25:44.261Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}