{"record":{"id":"ac27448a838fcf68","repo":"Fission-AI/OpenSpec","slug":"copied-src-to-dest-but-could-not-remove-the","errorCode":null,"errorMessage":"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.","messagePattern":"Copied (.+?) to (.+?), but could not remove the staged source at (.+?) completely \\((.+?)\\)\\. The complete destination was retained for recovery\\.","errorType":"exception","errorClass":"MoveDestinationRetainedError","httpStatus":null,"severity":"error","filePath":"src/core/archive.ts","lineNumber":559,"sourceCode":"        await fs.rm(dest, { recursive: true, force: true }).catch(() => undefined);\n        try {\n          await fs.rename(stagedSource, src);\n        } catch (restoreError) {\n          throw new Error(\n            `${verificationError instanceof Error ? verificationError.message : String(verificationError)} ` +\n              `Could not restore the staged source at ${stagedSource} ` +\n              `(${restoreError instanceof Error ? restoreError.message : String(restoreError)}).`\n          );\n        }\n        throw verificationError;\n      }\n      try {\n        await fs.rm(stagedSource, { recursive: true, force: true });\n      } catch (cleanupError) {\n        // Recursive removal may already have deleted part of the source. The\n        // destination is now the only complete copy, so never erase it while\n        // trying to make this failed move look atomic.\n        throw new MoveDestinationRetainedError(\n          `Copied ${src} to ${dest}, but could not remove the staged source at ` +\n            `${stagedSource} completely ` +\n            `(${cleanupError instanceof Error ? cleanupError.message : String(cleanupError)}). ` +\n            'The complete destination was retained for recovery.'\n        );\n      }\n    } else {\n      throw err;\n    }\n  }\n}\n\nasync function assertArchiveDestinationAvailable(\n  archivePath: string,\n  archiveName: string\n): Promise<void> {\n  try {\n    await fs.lstat(archivePath);","sourceCodeStart":541,"sourceCodeEnd":577,"githubUrl":"https://github.com/Fission-AI/OpenSpec/blob/6926ccb18afa4ff621112813e9968334576ee11a/src/core/archive.ts#L541-L577","documentation":"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.","triggerScenarios":"Thrown at src/core/archive.ts:559 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6926ccb18afa4ff621112813e9968334576ee11a","analyzedAt":"2026-08-25T12:29:45.729Z","schemaVersion":2},"datasetVersion":"2026-08-25T16:17:27.014Z"}