Egonex-AI/Understand-Anything · error · BenchmarkReportWriteError
Unable to write benchmark report files
Error message
Unable to write benchmark report files
What it means
BenchmarkReportWriteError thrown at the end of deliverBenchmarkReports when deliveryFailed is true OR any of the recovery cleanup counters (tempCleanupFailures, backupCleanupFailures, lockReleaseFailures) are non-zero. It is the catch-all for any failure in the staged write — the harness rolls back and then reports the partial state via the recovery object rather than leaving the caller with a silently-inconsistent filesystem.
Source
Thrown at scripts/lib/large-repo-benchmark.mjs:997
for (const entry of entries) {
if (entry.tempCreated) {
if (!tryRemove(entry.tempPath, fileSystem)) {
recovery.tempCleanupFailures += 1;
}
}
}
if (lockOwned && !tryRemove(lockPath, fileSystem)) {
recovery.lockReleaseFailures += 1;
}
}
if (
deliveryFailed ||
recovery.tempCleanupFailures > 0 ||
recovery.backupCleanupFailures > 0 ||
recovery.lockReleaseFailures > 0
) {
throw new BenchmarkReportWriteError(null, recovery);
}
}
function markdownValue(value) {
if (value === null || value === undefined) return 'n/a';
return String(value).replaceAll('|', '\\|').replaceAll(/\r?\n/g, ' ');
}
function metricRow(label, value) {
return `| ${label} | ${markdownValue(value)} |`;
}
function duration(value) {
return value === null || value === undefined ? 'n/a' : `${value} ms`;
}
function bytes(value) {
return value === null || value === undefinedView on GitHub (pinned to 32944829e7)
Solutions
- Free disk space and confirm write permission on the report directory, then re-run.
- Examine error.recovery (lockAcquisitionFailed, tempCleanupFailures, backupCleanupFailures, lockReleaseFailures) — the specific non-zero counter points at which phase failed.
- On Windows, close editors / disable sync clients (OneDrive, Dropbox) over the report directory so file handles release.
- Remove any stranded .ua-report-*.tmp / .backup / lock files from the directory (see error 24) before retrying.
- If the lock release failed, delete the lock file at reportPairLockPath(outputPath, markdownPath) manually once you are sure no other benchmark is running.
Example fix
// before — caller treats all failures the same
try { deliverBenchmarkReports(opts); }
catch (e) { console.error('write failed'); }
// after — inspect recovery to diagnose the phase
try { deliverBenchmarkReports(opts); }
catch (e) {
if (e instanceof BenchmarkReportWriteError) {
console.error('report write failed; recovery=', e.recovery);
} else throw e;
} Defensive patterns
Strategy: try-catch
Validate before calling
import { accessSync, constants } from 'node:fs';
function ensureReportDirWritable(outputPath, markdownPath) {
for (const p of [outputPath, markdownPath]) {
const dir = dirname(p);
accessSync(dir, constants.W_OK | constants.X_OK);
}
} Try / catch
try {
deliverBenchmarkReports(opts);
} catch (e) {
if (e instanceof BenchmarkReportWriteError) {
console.error('report delivery failed; recovery =', e.recovery);
// recovery.lockAcquisitionFailed, .tempCleanupFailures,
// .backupCleanupFailures, .lockReleaseFailures pinpoint the phase
} else throw e;
} Prevention
- Confirm the report directory is writable and has free space before running.
- On Windows, exclude the report directory from sync clients and close editors that hold handles.
- Inspect error.recovery to localise the failing phase instead of treating all failures identically.
When it happens
Trigger: The outer try/catch in deliverBenchmarkReports caught any exception (set deliveryFailed=true and rolled back), OR the finally block could not remove a temp file, could not remove a backup file, or could not release the pair lock. The throw at line 997 converts that into a typed BenchmarkReportWriteError carrying the recovery counters.
Common situations: Read-only or out-of-space target directory (temp write fails, then cleanup of a half-written temp also fails). Antivirus / sync client holding file handles on Windows preventing unlink. Permission changed mid-run. The lock file could not be removed (e.g. directory permissions changed after acquisition). Disk full so writeFileSync partially wrote then rename failed.
Related errors
- Benchmark report files must share a directory
- A report transaction path already exists
- A benchmark report target is a directory
- Unable to remove temporary benchmark artifacts
- Repository path does not exist: ${repoValue}
AI-assisted analysis of Egonex-AI/Understand-Anything@32944829e7 (2026-08-12).
Data as JSON: /api/errors/22e2f0ee0b1aff3c.
Report an issue: GitHub.