Egonex-AI/Understand-Anything · error · Error

A report transaction path already exists

Error message

A report transaction path already exists

What it means

Thrown inside the report transaction after the pair lock is acquired but before staging begins. For each entry the harness checks whether its tempPath or backupPath already exists on disk; if either does, it refuses to proceed because the backup/temp files are how it rolls back atomically — a pre-existing leftover means a prior transaction was interrupted and the rename install could overwrite or shadow state unpredictably.

Source

Thrown at scripts/lib/large-repo-benchmark.mjs:951

    let lockDescriptor;
    try {
      lockDescriptor = fileSystem.openSync(lockPath, 'wx');
      lockOwned = true;
      fileSystem.closeSync(lockDescriptor);
    } catch (error) {
      if (!lockOwned) recovery.lockAcquisitionFailed = true;
      throw error;
    }
    preflightReportTargets(
      entries.map((entry) => entry.targetPath),
      fileSystem,
    );
    for (const entry of entries) {
      if (
        fileSystem.existsSync(entry.tempPath) ||
        fileSystem.existsSync(entry.backupPath)
      ) {
        throw new Error('A report transaction path already exists');
      }
      entry.hadOriginal = fileSystem.existsSync(entry.targetPath);
      stageReportEntry(entry, fileSystem);
    }
    for (const entry of entries) {
      if (entry.hadOriginal) {
        fileSystem.renameSync(entry.targetPath, entry.backupPath);
        entry.backupMoved = true;
      }
    }
    for (const entry of entries) {
      entry.installAttempted = true;
      fileSystem.renameSync(entry.tempPath, entry.targetPath);
    }
    for (const entry of entries) {
      if (entry.backupMoved) {
        if (!tryRemove(entry.backupPath, fileSystem)) {
          recovery.backupCleanupFailures += 1;

View on GitHub (pinned to 32944829e7)

Solutions

  1. Inspect the target directory for leftover dotfiles: ls -la <report-dir> and look for .<basename>.ua-report-*.tmp and .<basename>.ua-report-*.backup.
  2. Remove the leftovers once you confirm no live benchmark is running: rm -f '<dir>/.*.ua-report-*.{tmp,backup}'.
  3. Re-run the benchmark; the transaction will stage cleanly.
  4. If leftovers keep appearing, check that nothing (an editor, sync agent, watcher) is recreating them, and that prior runs are exiting normally.

Example fix

// before — leftover from a crashed run blocks the next delivery
ls ./reports
# .bench.json.ua-report-7c1f.tmp  .bench.json.ua-report-7c1f.backup  bench.json

// after — clear stranded transaction files, then re-run
rm -f ./reports/.*.ua-report-*.tmp ./reports/.*.ua-report-*.backup
node scripts/large-repo-benchmark.mjs --output ./reports/bench.json --markdown ./reports/bench.md
Defensive patterns

Strategy: validation

Validate before calling

import { existsSync, readdirSync, rmSync } from 'node:fs';
import { join, basename, dirname } from 'node:path';
function clearStrandedTransactionFiles(outputPath, markdownPath) {
  const dirs = new Set([dirname(outputPath), dirname(markdownPath)]);
  for (const dir of dirs) {
    for (const name of readdirSync(dir)) {
      if (/\.ua-report-.*\.(tmp|backup)$/.test(name)) {
        rmSync(join(dir, name), { force: true });
      }
    }
  }
}

Try / catch

try {
  deliverBenchmarkReports(opts);
} catch (e) {
  if (/path already exists/.test(e.message)) {
    console.error('Stranded .ua-report-*.{tmp,backup} found — remove them and retry.');
  }
  throw e;
}

Prevention

When it happens

Trigger: A previous benchmark run crashed (SIGKILL, OOM, power loss) between staging and cleanup, leaving a .<name>.ua-report-<id>.tmp or .<name>.ua-report-<id>.backup file in the target directory. The next run acquires a fresh lock (the lock file was removed or never created) but finds the stranded temp/backup files and aborts.

Common situations: Interrupting a benchmark with Ctrl-C or killing the process during delivery. A CI runner that was preempted mid-run. Two concurrent benchmark runs targeting the same directory where one died. Manual experimentation that left .ua-report-*.tmp/.backup files behind.

Related errors


AI-assisted analysis of Egonex-AI/Understand-Anything@32944829e7 (2026-08-12). Data as JSON: /api/errors/2163ae325b5c39eb. Report an issue: GitHub.