0X800F0204

SPAPI_E_KEY_DOES_NOT_EXIST 0X800F0204: Real Fixes That Work

SPAPI_E_KEY_DOES_NOT_EXIST usually hits when a driver install or device update references a missing registry key. Often it's stale driver store entries or corrupted INF cache. Here's how to fix it without nuking Windows.

Cause 1: Stale Driver Store entries that point to a deleted key

What's actually happening here is that Windows keeps a database of every driver package it has ever staged in %SystemRoot%\System32\DriverStore\FileRepository. When you install a device, the setup API (setupapi) looks up that package by its registry key. If the key was removed—typically after a previous driver uninstall or a failed cleanup—setupapi throws SPAPI_E_KEY_DOES_NOT_EXIST because it can't find the source INF's registry entry.

This usually shows up when you try to update a device driver via Device Manager after you've manually deleted driver files or used a third-party cleaner that gutted the driver store. The driver package is still referenced in the INF cache, but the actual registry key under HKLM\SYSTEM\CurrentControlSet\Control\Class is gone.

Fix: Purge the stale driver package with pnputil

Skip the rabbit hole of hunting registry keys. The real fix is to delete the orphaned driver package from the driver store, which forces Windows to re-stage it cleanly on the next install. Open an elevated Command Prompt (Win+X → Command Prompt (Admin)) and list all third-party driver packages:

pnputil /enum-drivers

Look for the driver that corresponds to the device you're trying to install. The output shows the original INF name (like oem42.inf) and the provider. Once you spot it, note the published name and run:

pnputil /delete-driver oem42.inf /uninstall /force

The /force flag is key—it removes the package even if a device is currently using it. Without it, you'll get an error saying the package is in use. After deletion, reboot and try installing the driver again. Windows will now treat it as a fresh package and create a new registry key, so the error disappears.

Why does this work? Because pnputil /delete-driver removes both the driver files and the associated registry key. It's the official way to clean the driver store, and it's what Microsoft recommends for driver corruption issues.

Cause 2: Corrupted INF cache (the %SystemRoot%\INF\INFCACHE.1 file)

Another frequent trigger is a corrupted or oversized INFCACHE.1 file. Windows builds this binary cache to speed up INF searches during driver installation. If the cache gets out of sync—say, after a botched Windows Update or an abrupt power loss while installing a driver—setupapi can't find the INF that the cache references, and you'll see the same error code.

You'll know it's the INF cache if the error appears across multiple devices, not just one. I've seen this on Windows 10 21H2 machines where the cache file had grown to several megabytes due to repeated driver installs.

Fix: Rebuild the INF cache

This is a straightforward fix, but you need to handle it correctly because Windows locks the cache file while running. Boot into Safe Mode (Shift+Restart → Troubleshoot → Advanced Options → Startup Settings → Restart → press 4). In Safe Mode, the INF cache is not in use, so you can safely delete it:

del C:\Windows\INF\INFCACHE.1

Reboot to normal mode. Windows will recreate the file automatically on the next driver installation. No need to manually rebuild it—the setupapi creates it on demand. If you're not comfortable with Safe Mode, you can stop the Plug and Play service and delete it, but that's riskier because many services depend on PnP. Stick with Safe Mode.

One caution: after deleting the cache, the first driver install might be slower because Windows is rebuilding the index. That's normal. Give it a minute.

Cause 3: Registry permission restrictions on the device class key

The third scenario is less about corruption and more about permissions. If you're running a standard user account, or if a previous system image restore screwed up ACLs, the setupapi might not have write access to the class-specific registry key under HKLM\SYSTEM\CurrentControlSet\Control\Class. Without write access, it fails to create the new device key, throwing SPAPI_E_KEY_DOES_NOT_EXIST even though the key technically exists but isn't accessible.

This is rare, but I've encountered it on corporate laptops where IT pushed a restrictive security policy that locked down those registry keys.

Fix: Restore default ACLs on the Class key (as Administrator)

Run an elevated Command Prompt and use secedit to export the current security policy, or directly reset the key permissions using regini. The cleanest method is to use regini with a script file that resets the key to full control for SYSTEM and Administrators. Create a file, say fix.ini, with this content:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class [1 5 7 17]

The numbers set permissions: 1 = Administrators full control, 5 = SYSTEM full control, 7 = Users read, 17 = Creator/Owner special. Then run:

regini fix.ini

After applying, reboot and retry the driver installation. If you're not comfortable with regini, an alternative is to use the registry editor to manually grant Full Control to the Administrators group on the specific class subkey (the GUID that corresponds to your device's class, e.g., {4d36e968-e325-11ce-bfc1-08002be10318} for display adapters). Right-click the class key → Permissions → Add → Enter Administrators → Check Full Control.

What's actually happening here is that the device installation requires creating a new subkey under the class GUID. Without administrative write access, setupapi thinks the key doesn't exist because it can't see a writable path.

Quick-reference summary

Cause Symptom Fix
Stale driver store package Error after uninstall or manual file deletion pnputil /delete-driver oemXX.inf /uninstall /force
Corrupted INF cache Error across multiple devices, recent power loss Boot Safe Mode, delete C:\Windows\INF\INFCACHE.1
Registry permissions Standard user account, or after policy push regini or manual Full Control on Class key

Try them in that order—cause #1 is the most common, so start with the pnputil cleanup. If that doesn't kill the error, move to the INF cache, and only then start messing with registry ACLs. The last one is the least likely, so don't do it unless the first two fail.

Related Errors in Windows Errors
0X000032CD Fix ERROR_IPSEC_MM_POLICY_IN_USE (0x000032CD) – policy in use 0XC015000E Fix STATUS_SXS_PROCESS_DEFAULT_ALREADY_SET (0xC015000E) on Windows 0X0000211D Fix ERROR_DS_DRA_REPL_PENDING (0X0000211D) on Windows Server 0X8004E026 CONTEXT_E_NOJIT (0x8004E026) Fix — COM+ JIT Activation Error

Was this solution helpful?

EP
Erropedia Team
Tech Support Editors
The Erropedia editorial team researches and documents real-world tech errors from across Windows, Linux, macOS, networking, databases, cloud platforms, and more. Every solution is reviewed for accuracy and updated as software and systems evolve.