{"record":{"id":"87eda68466242afd","repo":"BCUninstaller/Bulk-Crap-Uninstaller","slug":"failed-to-enable-this-entry-the-following-file-wa","errorCode":null,"errorMessage":"Failed to enable this entry, the following file was not found:\\n\\n{startupEntry.FullLongName}","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":179,"sourceCode":"                {\r\n                    startupEntry.Delete();\r\n                }\r\n                catch\r\n                {\r\n                    // Key doesn't exist\r\n                }\r\n            }\r\n            else\r\n            {\r\n                if (File.Exists(startupEntry.FullLongName))\r\n                {\r\n                    File.Delete(newPath);\r\n                    Directory.CreateDirectory(DriveDisableBackupPath);\r\n                    File.Move(startupEntry.FullLongName, newPath);\r\n                    startupEntry.BackupPath = newPath;\r\n                }\r\n                else\r\n                    throw new InvalidOperationException(Localisation.StartupManager_FailedEnable_FileNotFound\r\n                                                        + \"\\n\\n\" + startupEntry.FullLongName);\r\n            }\r\n\r\n            CreateDisabledEntry(startupEntry, newPath);\r\n\r\n            startupEntry.DisabledStore = true;\r\n        }\r\n\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","sourceCodeStart":161,"sourceCodeEnd":197,"githubUrl":"https://github.com/BCUninstaller/Bulk-Crap-Uninstaller/blob/608321de98e92297377b1eb69029af55c25504a1/source/UninstallTools/Startup/Normal/OldStartupDisable.cs#L161-L197","documentation":"Thrown in the file-based startup-disable flow when disabling a non-registry StartupEntry: the code checks File.Exists(startupEntry.FullLongName) and, if false, throws InvalidOperationException with StartupManager_FailedEnable_FileNotFound plus the missing path. The disable path needs to move the startup file to a backup location (DriveDisableBackupPath); if the source file is gone the move cannot proceed.","triggerScenarios":"Calling the disable routine on a StartupEntry whose FullLongName points to a file that does not exist on disk — the startup shortcut/binary was deleted by another uninstaller, moved, or the path is on a removable drive that is no longer attached.","commonSituations":"A previous uninstall removed the binary but left the startup registration; the entry's path is stale; the file lives on a network/USB drive that is disconnected; path stored with a short (8.3) name that no longer resolves.","solutions":["Before disabling, verify File.Exists(startupEntry.FullLongName) and skip/remove the entry if the file is gone (the registration is already effectively dead).","Refresh the startup entry list before acting so stale entries are pruned.","Resolve FullLongName to a long path (Path.GetFullPath) before the existence check to avoid 8.3 name mismatches."],"exampleFix":"// before\ndisableService.Disable(entry);\n\n// after\nif (!entry.IsRegKey && !File.Exists(entry.FullLongName))\n{\n    // file already gone; just drop the registration\n    StartupEntryManager.RemoveEntry(entry);\n    return;\n}\ndisableService.Disable(entry);","handlingStrategy":"validation","validationCode":"if (!entry.IsRegKey && !File.Exists(entry.FullLongName))\n{\n    StartupEntryManager.RemoveEntry(entry); // registration is already dead\n    return;\n}\ndisableService.Disable(entry);","typeGuard":"null","tryCatchPattern":"try { disableService.Disable(entry); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(Localisation.StartupManager_FailedEnable_FileNotFound))\n{\n    StartupEntryManager.RemoveEntry(entry);\n}","preventionTips":["Refresh the startup entry list before acting so stale entries are pruned.","Resolve FullLongName via Path.GetFullPath before the existence check.","Watch for entries whose binary was removed by a prior uninstall."],"tags":["startup-manager","io","invalid-operation","file-not-found","windows"],"backgroundTag":null,"analyzedSha":"608321de98e92297377b1eb69029af55c25504a1","analyzedAt":"2026-08-13T12:17:35.389Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}