BCUninstaller/Bulk-Crap-Uninstaller · error · InvalidOperationException

Failed to enable this entry, the following file was not…

Error message

Failed to enable this entry, the following file was not found:\n\n{oldPath}

What it means

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.

Solutions

  1. 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.
  2. Verify the backup volume is mounted and the path in BackupPath still resolves.
  3. Treat a missing backup as a recovery case: log it, recreate the startup registration manually, and clear DisabledStore.

Example fix

// before
_disableService.Enable(entry);

// after
var backupPath = GetDisabledEntryPath(entry);
if (!File.Exists(backupPath))
{
    StartupEntryManager.CreateRegValue(entry); // or recreate shortcut
    entry.DisabledStore = false;
    return;
}
_disableService.Enable(entry);
Defensive patterns

Strategy: validation

Validate before calling

var backup = disableService.GetDisabledEntryPath(entry);
if (!entry.IsRegKey && entry.DisabledStore && !File.Exists(backup))
{
    // backup gone: recreate the registration directly
    StartupEntryManager.CreateRegValue(entry);
    entry.DisabledStore = false;
    return;
}
disableService.Enable(entry);

Type guard

null

Try / catch

try { disableService.Enable(entry); }
catch (InvalidOperationException ex) when (ex.Message.Contains(Localisation.StartupManager_FailedEnable_FileNotFound))
{
    StartupEntryManager.CreateRegValue(entry);
    entry.DisabledStore = false;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of BCUninstaller/Bulk-Crap-Uninstaller@608321de98 (2026-08-13). Data as JSON: /api/errors/8680a2a12708f556. Report an issue: GitHub.

Appendix: source

Thrown at source/UninstallTools/Startup/Normal/OldStartupDisable.cs:205

        public void Enable(StartupEntry startupEntry)
        {
            if (!startupEntry.DisabledStore)
                return;

            // Reconstruct the startup entry
            if (!startupEntry.IsRegKey)
            {
                // Move the backup file back to its original location
                var oldPath = GetDisabledEntryPath(startupEntry);

                if (File.Exists(oldPath))
                {
                    File.Delete(startupEntry.FullLongName);
                    File.Move(oldPath, startupEntry.FullLongName);
                }
                else
                    throw new InvalidOperationException(Localisation.StartupManager_FailedEnable_FileNotFound
                                                        + "\n\n" + oldPath);
            }
            else
            {
                // Recreate the registry key
                StartupEntryManager.CreateRegValue(startupEntry);
            }

            Delete(startupEntry);

            startupEntry.BackupPath = string.Empty;
            // Entry is no longer disabled
            startupEntry.DisabledStore = false;
        }

        /// <summary>
        ///     Create backup store path for the link. The backup extension is appended as well.
        ///     Works only for links, returns garbage for registry values.

View on GitHub (pinned to 608321de98)