{"record":{"id":"8680a2a12708f556","repo":"BCUninstaller/Bulk-Crap-Uninstaller","slug":"failed-to-enable-this-entry-the-following-file-wa-8680a2","errorCode":null,"errorMessage":"Failed to enable this entry, the following file was not found:\\n\\n{oldPath}","messagePattern":"Failed to enable this entry, the following file was not found:\\\\n\\\\n(.+?)","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"source/UninstallTools/Startup/Normal/OldStartupDisable.cs","lineNumber":205,"sourceCode":"\r\n        public void Enable(StartupEntry startupEntry)\r\n        {\r\n            if (!startupEntry.DisabledStore)\r\n                return;\r\n\r\n            // Reconstruct the startup entry\r\n            if (!startupEntry.IsRegKey)\r\n            {\r\n                // Move the backup file back to its original location\r\n                var oldPath = GetDisabledEntryPath(startupEntry);\r\n\r\n                if (File.Exists(oldPath))\r\n                {\r\n                    File.Delete(startupEntry.FullLongName);\r\n                    File.Move(oldPath, startupEntry.FullLongName);\r\n                }\r\n                else\r\n                    throw new InvalidOperationException(Localisation.StartupManager_FailedEnable_FileNotFound\r\n                                                        + \"\\n\\n\" + oldPath);\r\n            }\r\n            else\r\n            {\r\n                // Recreate the registry key\r\n                StartupEntryManager.CreateRegValue(startupEntry);\r\n            }\r\n\r\n            Delete(startupEntry);\r\n\r\n            startupEntry.BackupPath = string.Empty;\r\n            // Entry is no longer disabled\r\n            startupEntry.DisabledStore = false;\r\n        }\r\n\r\n        /// <summary>\r\n        ///     Create backup store path for the link. The backup extension is appended as well.\r\n        ///     Works only for links, returns garbage for registry values.\r","sourceCodeStart":187,"sourceCodeEnd":223,"githubUrl":"https://github.com/BCUninstaller/Bulk-Crap-Uninstaller/blob/608321de98e92297377b1eb69029af55c25504a1/source/UninstallTools/Startup/Normal/OldStartupDisable.cs#L187-L223","documentation":"Thrown in the enable flow when restoring a previously disabled file-based StartupEntry: GetDisabledEntryPath returns the backup location oldPath, and if File.Exists(oldPath) is false the code throws InvalidOperationException with StartupManager_FailedEnable_FileNotFound plus oldPath. The backup file that the disable step created is required to move the entry back to its original location.","triggerScenarios":"Calling Enable on a StartupEntry whose DisabledStore is true but whose backup file (on DriveDisableBackupPath) has been deleted, moved, or is on a volume that is no longer mounted.","commonSituations":"The user manually cleaned the backup folder; an antivirus quarantined the moved file; the backup was on a temp drive that was cleared; the disable step never actually completed the File.Move but still set DisabledStore=true.","solutions":["Before calling Enable, check File.Exists(GetDisabledEntryPath(entry)) and, if missing, recreate the entry from a known-good source or recreate the startup shortcut directly.","Verify the backup volume is mounted and the path in BackupPath still resolves.","Treat a missing backup as a recovery case: log it, recreate the startup registration manually, and clear DisabledStore."],"exampleFix":"// before\n_disableService.Enable(entry);\n\n// after\nvar backupPath = GetDisabledEntryPath(entry);\nif (!File.Exists(backupPath))\n{\n    StartupEntryManager.CreateRegValue(entry); // or recreate shortcut\n    entry.DisabledStore = false;\n    return;\n}\n_disableService.Enable(entry);","handlingStrategy":"validation","validationCode":"var backup = disableService.GetDisabledEntryPath(entry);\nif (!entry.IsRegKey && entry.DisabledStore && !File.Exists(backup))\n{\n    // backup gone: recreate the registration directly\n    StartupEntryManager.CreateRegValue(entry);\n    entry.DisabledStore = false;\n    return;\n}\ndisableService.Enable(entry);","typeGuard":"null","tryCatchPattern":"try { disableService.Enable(entry); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(Localisation.StartupManager_FailedEnable_FileNotFound))\n{\n    StartupEntryManager.CreateRegValue(entry);\n    entry.DisabledStore = false;\n}","preventionTips":["Verify the backup volume is still mounted before enabling.","Never set DisabledStore=true unless the File.Move in Disable actually succeeded.","Keep backups off temp drives that get cleared on reboot."],"tags":["startup-manager","io","invalid-operation","file-not-found","backup-restore"],"backgroundTag":null,"analyzedSha":"608321de98e92297377b1eb69029af55c25504a1","analyzedAt":"2026-08-13T12:17:35.389Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}