{"record":{"id":"25a54721df83b7e6","repo":"Fission-AI/OpenSpec","slug":"schema-destinationname-at-destinationdir-c","errorCode":null,"errorMessage":"Schema '${destinationName}' at ${destinationDir} changed on disk while the fork was being prepared. Aborted to preserve those concurrent changes; nothing was overwritten. Re-run the fork to overwrite the current contents.","messagePattern":"Schema '(.+?)' at (.+?) changed on disk while the fork was being prepared\\. Aborted to preserve those concurrent changes; nothing was overwritten\\. Re-run the fork to overwrite the current contents\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/commands/schema.ts","lineNumber":831,"sourceCode":"\n          // Swap the staged fork into place. When a destination already exists,\n          // move it aside to a sibling backup FIRST, then install the staged\n          // fork; only once the install succeeds is the backup discarded. If the\n          // install rename itself fails (e.g. a Windows lock), the backup is\n          // moved back so the user's original destination is never lost.\n          if (destinationExists) {\n            if (spinner) spinner.text = `Replacing existing schema '${destinationName}'...`;\n\n            // Revalidate immediately before the destructive move: if the\n            // destination changed on disk while we were staging (or was removed),\n            // its fingerprint no longer matches what the user authorized. Abort\n            // WITHOUT touching it, so the concurrent changes are preserved. The\n            // outer catch cleans up staging.\n            const currentFingerprint = fs.existsSync(destinationDir)\n              ? fingerprintDir(destinationDir)\n              : null;\n            if (currentFingerprint !== authorizedDestinationFingerprint) {\n              throw new Error(\n                `Schema '${destinationName}' at ${destinationDir} changed on disk while the fork was being prepared. ` +\n                  `Aborted to preserve those concurrent changes; nothing was overwritten. Re-run the fork to overwrite the current contents.`\n              );\n            }\n\n            const backupDir = `${destinationDir}.fork-backup-${process.pid}-${Date.now()}`;\n            fs.renameSync(destinationDir, backupDir);\n            try {\n              fs.renameSync(stagingDir, destinationDir);\n            } catch (installError) {\n              // Install failed after the original was moved aside. Try to move\n              // it back. If that restore ALSO fails, the original is stranded in\n              // the backup dir — surface an error naming both the backup and the\n              // destination so the user can recover manually, and attach the\n              // original install error as the cause. Never swallow this.\n              try {\n                fs.renameSync(backupDir, destinationDir);\n              } catch (restoreError) {","sourceCodeStart":813,"sourceCodeEnd":849,"githubUrl":"https://github.com/Fission-AI/OpenSpec/blob/6926ccb18afa4ff621112813e9968334576ee11a/src/commands/schema.ts#L813-L849","documentation":"Error \"Schema '${destinationName}' at ${destinationDir} changed on disk while the fork was being prepared. Aborted to preserve those concurrent changes; nothing was overwritten. Re-run the fork to overwrite the current contents.\" thrown in Fission-AI/OpenSpec.","triggerScenarios":"Thrown at src/commands/schema.ts:831 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"}