Fission-AI/OpenSpec · error · Error

Change directory contents changed during the fallback copy…

Error message

Change directory contents changed during the fallback copy from ${stagedSource} to ${destination}.

What it means

Integrity guard after the fallback archive copy: the staged source or the destination fingerprint no longer matches the pre-copy fingerprint, meaning contents changed during the copy; the copy is discarded/aborted.

Solutions

  1. Ensure no process edits the change directory during archive and re-run
  2. Investigate what is writing to the staged/destination directories
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/core/archive.ts:461 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/914a4d067be7eddd. Report an issue: GitHub.

Appendix: source

Thrown at src/core/archive.ts:461

    }
  };

  await visit(root, '');
  return hash.digest('hex');
}

async function assertCopiedDirectoryUnchanged(
  stagedSource: string,
  destination: string,
  expectedFingerprint: string
): Promise<void> {
  const sourceFingerprint = await fingerprintDirectoryContents(stagedSource);
  const destinationFingerprint = await fingerprintDirectoryContents(destination);
  if (
    sourceFingerprint !== expectedFingerprint ||
    destinationFingerprint !== expectedFingerprint
  ) {
    throw new Error(
      `Change directory contents changed during the fallback copy from ${stagedSource} to ${destination}.`
    );
  }
}

/**
 * Move a directory from src to dest. On Windows, fs.rename() can fail with
 * EPERM, and cross-device moves fail with EXDEV. When the source can first be
 * renamed to a private sibling, fall back to a verified copy-then-remove. A
 * source that cannot be staged is left untouched rather than copied and deleted
 * through a path another process may still be editing.
 */
class MoveDestinationRetainedError extends Error {}
class RetirementBackupsRetainedError extends Error {}

async function moveDirectory(
  src: string,
  dest: string,

View on GitHub (pinned to 6926ccb18a)