Fission-AI/OpenSpec · error · MoveDestinationRetainedError

Copied ${src} to ${dest}, but could not remove the staged so

Error message

Copied ${src} to ${dest}, but could not remove the staged source at ${stagedSource} completely (${cleanupError instanceof Error ? cleanupError.message : String(cleanupError)}). The complete destination was retained for recovery.

What it means

Error "Copied ${src} to ${dest}, but could not remove the staged source at ${stagedSource} completely (${cleanupError instanceof Error ? cleanupError.message : String(cleanupError)}). The complete destination was retained for recovery." thrown in Fission-AI/OpenSpec.

Source

Thrown at src/core/archive.ts:559

        await fs.rm(dest, { recursive: true, force: true }).catch(() => undefined);
        try {
          await fs.rename(stagedSource, src);
        } catch (restoreError) {
          throw new Error(
            `${verificationError instanceof Error ? verificationError.message : String(verificationError)} ` +
              `Could not restore the staged source at ${stagedSource} ` +
              `(${restoreError instanceof Error ? restoreError.message : String(restoreError)}).`
          );
        }
        throw verificationError;
      }
      try {
        await fs.rm(stagedSource, { recursive: true, force: true });
      } catch (cleanupError) {
        // Recursive removal may already have deleted part of the source. The
        // destination is now the only complete copy, so never erase it while
        // trying to make this failed move look atomic.
        throw new MoveDestinationRetainedError(
          `Copied ${src} to ${dest}, but could not remove the staged source at ` +
            `${stagedSource} completely ` +
            `(${cleanupError instanceof Error ? cleanupError.message : String(cleanupError)}). ` +
            'The complete destination was retained for recovery.'
        );
      }
    } else {
      throw err;
    }
  }
}

async function assertArchiveDestinationAvailable(
  archivePath: string,
  archiveName: string
): Promise<void> {
  try {
    await fs.lstat(archivePath);

View on GitHub (pinned to 6926ccb18a)

When it happens

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