BCUninstaller/Bulk-Crap-Uninstaller · error · Exception

Access is denied. Indicates that user has no access right to

Error message

Access is denied. Indicates that user has no access right to specified resource.

What it means

The exit-code switch maps exitVar == 5 to a thrown Exception describing ERROR_ACCESS_DENIED. The spawned uninstaller exited with code 5, indicating the OS denied access to a resource the process tried to open/write/delete.

Source

Thrown at source/UninstallTools/Uninstaller/BulkUninstallEntry.cs:441

                            }
                            else if (exitVar == -1073741510)
                            {
                                /* 3221225786 / 0xC000013A / -1073741510 
                                    The application terminated as a result of a CTRL+C. 
                                    Indicates that the application has been terminated either by user's 
                                    keyboard input CTRL+C or CTRL+Break or closing command prompt window. */
                                _skipLevel = SkipCurrentLevel.Terminate;
                            }
                            else
                            {
                                switch (exitVar)
                                {
                                    case 2:
                                        throw new Exception("The system cannot find the file specified. Indicates that the file can not be found in specified location.");
                                    case 3:
                                        throw new Exception("The system cannot find the path specified. Indicates that the specified path can not be found.");
                                    case 5:
                                        throw new Exception("Access is denied. Indicates that user has no access right to specified resource.");
                                    case 9009:
                                        throw new Exception("Program is not recognized as an internal or external command, operable program or batch file.");
                                    case -2147024846:
                                        throw new Exception("0x80070032 - This app is part of Windows and cannot be uninstalled on a per-user basis.");

                                    default:
                                        if (options.RetryFailedQuiet || (UninstallerEntry.UninstallerKind == UninstallerType.Nsis && !options.PreferQuiet))
                                            retry = true;
                                        throw new IOException(Localisation.UninstallError_UninstallerReturnedCode + exitVar);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                error = ex;

View on GitHub (pinned to 608321de98)

Solutions

  1. Run the bulk uninstall elevated and ensure the target application and its background services are stopped first.
  2. Pre-scan for locked files / running processes of the target app and prompt the user to close them.
  3. Catch exit-code-5 specifically and offer to retry after elevation and process termination.

Example fix

// before
manager.RunUninstaller(entry, options);

// after
KillTargetProcesses(entry);
if (!HasElevation) { RestartAsAdmin(); return; }
manager.RunUninstaller(entry, options);
Defensive patterns

Strategy: retry

Validate before calling

if (!IsProcessElevated())
    throw new SecurityException("Uninstall requires elevation.");
KillTargetProcesses(entry); // release locks
manager.RunUninstaller(entry, options);

Type guard

null

Try / catch

// retry once after closing locks / elevating
try { manager.RunUninstaller(entry, options); }
catch (Exception ex) when (ExitCodeOf(ex) == 5)
{
    KillTargetProcesses(entry);
    manager.RunUninstaller(entry, options);
}

Prevention

When it happens

Trigger: The uninstaller ran without sufficient privileges to modify its target files/registry, or another process holds an exclusive lock on a file it must remove, causing the OS to return access-denied and the process to exit 5.

Common situations: App not elevated and the uninstaller needs admin rights to delete Program Files entries; the target app is currently running and locking its binaries; an antivirus or backup tool holds a lock during the uninstall.

Related errors


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