Fission-AI/OpenSpec · error · Error

Failed to install the forked schema and could not restore th

Error message

Failed to install the forked schema and could not restore the previous '${destinationName}'. Your previous schema is preserved at ${backupDir}; move it back to ${destinationDir} to restore. Restore error: ${(restoreError as Error).message}

What it means

Error "Failed to install the forked schema and could not restore the previous '${destinationName}'. Your previous schema is preserved at ${backupDir}; move it back to ${destinationDir} to restore. Restore error: ${(restoreError as Error).message}" thrown in Fission-AI/OpenSpec.

Source

Thrown at src/commands/schema.ts:850

                `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.`
              );
            }

            const backupDir = `${destinationDir}.fork-backup-${process.pid}-${Date.now()}`;
            fs.renameSync(destinationDir, backupDir);
            try {
              fs.renameSync(stagingDir, destinationDir);
            } catch (installError) {
              // Install failed after the original was moved aside. Try to move
              // it back. If that restore ALSO fails, the original is stranded in
              // the backup dir — surface an error naming both the backup and the
              // destination so the user can recover manually, and attach the
              // original install error as the cause. Never swallow this.
              try {
                fs.renameSync(backupDir, destinationDir);
              } catch (restoreError) {
                throw new Error(
                  `Failed to install the forked schema and could not restore the previous '${destinationName}'. ` +
                    `Your previous schema is preserved at ${backupDir}; move it back to ${destinationDir} to restore. ` +
                    `Restore error: ${(restoreError as Error).message}`,
                  { cause: installError }
                );
              }
              throw installError;
            }

            // Revalidate before discarding the backup: only delete it if it is
            // still byte-for-byte the original destination we moved aside. If it
            // changed during the install window (a concurrent write to the
            // moved-aside directory), do NOT delete it — leave it in place and
            // surface where it is so nothing is lost.
            if (fingerprintDir(backupDir) === authorizedDestinationFingerprint) {
              fs.rmSync(backupDir, { recursive: true, force: true });
            } else {
              console.error(

View on GitHub (pinned to 6926ccb18a)

When it happens

Trigger: Thrown at src/commands/schema.ts:850 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/0c5c32e89c21f42f. Report an issue: GitHub.