Fission-AI/OpenSpec · error · Error

Archive rollback would overwrite a concurrent change at

Error message

Archive rollback would overwrite a concurrent change at ${snapshot.target}.

What it means

Rollback safety guard in archive error handling: before restoring a snapshot target, its current content is compared to what the snapshot recorded; a mismatch means a concurrent edit happened and restoring would clobber it. Throws instead of overwriting the newer change.

Solutions

  1. Inspect the current content at the target path and reconcile manually
  2. Stop concurrent editors and re-run the archive/rollback
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/core/archive.ts:937 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Fission-AI/OpenSpec@6926ccb18a (2026-08-25). Data as JSON: /api/errors/5cf43abdb78da5b0. Report an issue: GitHub.

Appendix: source

Thrown at src/core/archive.ts:937

          snapshot.displacedPath = undefined;
          continue;
        }
        try {
          const current = await fs.lstat(snapshot.target);
          const unchangedSymlink =
            snapshot.symlink !== undefined &&
            current.isSymbolicLink() &&
            (await fs.readlink(snapshot.target)) === snapshot.symlink;
          // Re-read to confirm the target still holds the snapshot content; a
          // mismatch means a concurrent edit, and rollback throws below rather
          // than overwrite it (CodeQL js/file-system-race is intentional here).
          const unchangedFile =
            snapshot.symlink === undefined &&
            snapshot.content !== undefined &&
            current.isFile() &&
            (await fs.readFile(snapshot.target)).equals(snapshot.content);
          if (unchangedSymlink || unchangedFile) continue;
          throw new Error(
            `Archive rollback would overwrite a concurrent change at ${snapshot.target}.`
          );
        } catch (error) {
          if ((error as NodeJS.ErrnoException).code !== 'ENOENT') throw error;
        }
      } else {
        let current;
        try {
          current = await fs.lstat(snapshot.target);
        } catch (error) {
          if (
            (error as NodeJS.ErrnoException).code === 'ENOENT' &&
            !snapshot.existed
          ) {
            continue;
          }
          throw error;
        }

View on GitHub (pinned to 6926ccb18a)