Fission-AI/OpenSpec · error · ArchiveBlockedError

archive_target_exists

archive_target_exists

Error message

Archive '${path.basename(dest)}' already exists.

What it means

Error "Archive '${path.basename(dest)}' already exists." thrown in Fission-AI/OpenSpec.

Source

Thrown at src/core/archive.ts:491

 */
class MoveDestinationRetainedError extends Error {}
class RetirementBackupsRetainedError extends Error {}

async function moveDirectory(
  src: string,
  dest: string,
  options: {
    verifyCopiedDestination?: (stagedSource: string) => Promise<void>;
  } = {}
): Promise<void> {
  try {
    await fs.rename(src, dest);
  } catch (err: any) {
    const code = err?.code;
    // rename onto a non-empty directory: the destination was taken while the
    // archive was running. Same condition the pre-flight check reports.
    if (code === 'ENOTEMPTY' || code === 'EEXIST') {
      throw new ArchiveBlockedError(
        'archive_target_exists',
        `Archive '${path.basename(dest)}' already exists.`
      );
    }
    if (code === 'EPERM' || code === 'EXDEV') {
      const stagedSource = path.join(path.dirname(src), `.openspec-move-${randomUUID()}`);
      try {
        await fs.rename(src, stagedSource);
      } catch (stageError) {
        throw new Error(
          `Could not safely stage ${src} before the fallback archive copy ` +
            `(${stageError instanceof Error ? stageError.message : String(stageError)}). ` +
            'No fallback copy was attempted.'
        );
      }
      let destIsOurs = false;
      let stagedFingerprint: string;
      try {

View on GitHub (pinned to 6926ccb18a)

When it happens

Trigger: Thrown at src/core/archive.ts:491 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/694a2d2134c40e4c. Report an issue: GitHub.