BCUninstaller/Bulk-Crap-Uninstaller · error · IOException

Failed to open regedit.exe

Error message

Failed to open regedit.exe

What it means

Thrown by OpenRegKeyInRegedit as a catch-all: any exception inside the try block that is not already re-thrown (the SafeKillProcess failure and null CreateSubKey cases) is wrapped in this IOException with the original as InnerException. The message is generic; inspect InnerException for the real cause.

Source

Thrown at source/KlocTools/Tools/RegistryTools.cs:458

        {
            try
            {
                if (!ProcessTools.SafeKillProcess("regedit"))
                    throw new IOException("Could not close running instance of Regedit");

                var regeditSettings =
                    Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Applets\Regedit",
                        RegistryKeyPermissionCheck.ReadWriteSubTree);

                if (regeditSettings == null)
                    throw new IOException("Failed to set the last user registry key");

                regeditSettings.SetValue("LastKey", registryPath, RegistryValueKind.String);
                Process.Start("regedit.exe");
            }
            catch (Exception ex)
            {
                throw new IOException("Failed to open regedit.exe", ex);
            }
        }
    }
}

View on GitHub (pinned to 608321de98)

Solutions

  1. Catch this IOException and inspect ex.InnerException to identify the root cause.
  2. Ensure regedit.exe is present and launchable from the process (PATH / system integrity).
  3. Run elevated and in an interactive session so both the registry write and Process.Start succeed.
  4. Retry transient registry I/O failures with backoff.

Example fix

// before
RegistryTools.OpenRegKeyInRegedit(path);

// after
try { RegistryTools.OpenRegKeyInRegedit(path); }
catch (IOException ex)
{
    Log.Error("OpenRegKeyInRegedit failed", ex.InnerException ?? ex);
}
Defensive patterns

Strategy: try-catch

Try / catch

try { RegistryTools.OpenRegKeyInRegedit(path); }
catch (IOException ex)
{
    var root = ex.InnerException ?? ex;
    Log.Error($"OpenRegKeyInRegedit failed: {root.GetType().Name}: {root.Message}");
}

Prevention

When it happens

Trigger: Process.Start("regedit.exe") throwing (e.g. regedit not found, Win32Exception), SetValue throwing an UnauthorizedAccessException or IOException due to a locked key, or any other unexpected failure during the LastKey write or process launch.

Common situations: regedit.exe missing or blocked by policy; the Applets key locked by another process; transient registry I/O errors; antivirus blocking process launch.

Related errors


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