BCUninstaller/Bulk-Crap-Uninstaller · warning · IOException

Key "{FullRegKeyPath}" doesn't exist or can't be accessed

Error message

Key "{FullRegKeyPath}" doesn't exist or can't be accessed

What it means

Thrown by RegistryKeyJunk.Open() when RegKeyExists() returns false before attempting to open the key in regedit via RegistryTools.OpenRegKeyInRegedit. The junk-removal subsystem treats registry keys as disposable 'Junk' entries, and Open() is the user-facing 'show me this in regedit' action. It refuses to launch regedit for a key that has already been removed or that the current user cannot read.

Source

Thrown at source/UninstallTools/Junk/Containers/RegistryKeyJunk.cs:57

        public override void Backup(string backupDirectory)
        {
            var fileName = PathTools.SanitizeFileName(FullRegKeyPath.TrimStart('\\')) + ".reg";
            var path = Path.Combine(CreateBackupDirectory(backupDirectory), fileName);
            RegistryTools.ExportRegistry(path, new[] { FullRegKeyPath });
        }

        public override void Delete()
        {
            using (var key = RegistryTools.OpenRegistryKey(RegKeyParentPath, true))
            {
                key?.DeleteSubKeyTree(RegKeyName);
            }
        }

        public override void Open()
        {
            if (!RegKeyExists())
                throw new IOException($"Key \"{FullRegKeyPath}\" doesn't exist or can't be accessed");

            RegistryTools.OpenRegKeyInRegedit(FullRegKeyPath);
        }

        public override string GetDisplayName()
        {
            return FullRegKeyPath;
        }
    }
}

View on GitHub (pinned to 608321de98)

Solutions

  1. Call RegKeyExists() (or wrap Open() in try/catch IOException) before exposing an Open action in the UI, and disable/hide the action when false.
  2. Re-enumerate the junk list before opening so stale entries are dropped.
  3. If running elevated still fails, check the key's ACL with regedit/Get-Acl and grant the calling principal read access.

Example fix

// before
junkEntry.Open();

// after
if (junkEntry is RegistryKeyJunk rk && !rk.RegKeyExists())
{
    // refresh list / inform user the key is gone
    return;
}
junkEntry.Open();
Defensive patterns

Strategy: validation

Validate before calling

// Before opening a registry junk entry
if (junkEntry is RegistryKeyJunk rk && !rk.RegKeyExists())
{
    OnStaleEntry(rk);
    return;
}

Type guard

null

Try / catch

try { junkEntry.Open(); }
catch (IOException ex) when (ex.Message.Contains("doesn't exist or can't be accessed"))
{
    // entry was removed between enumeration and open; refresh the list
    RefreshJunkList();
}

Prevention

When it happens

Trigger: Calling Open() on a RegistryKeyJunk instance whose underlying key was deleted by a previous cleanup step, or whose hive/ACL denies the current user read access. Also happens if the key path is constructed from stale uninstaller metadata.

Common situations: A registry junk entry is enumerated, the user deletes it (Delete() runs), then double-clicks/opens it again; or another process/uninstaller removed the key between enumeration and the Open() call; or the app is run under an account that cannot read HKLM\SYSTEM\* subkeys.

Related errors


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