Fix Network Adapter Code 31: Device Not Working Properly
In this article
If you see "Windows cannot load the driver for this hardware because a previous instance of the device driver is still in memory" (Code 31) in Device Manager for your network adapter, the fix is to clear the stuck driver instance and reinstall the adapter. This usually means uninstalling the device, deleting the hidden driver remnants, and letting Windows re-detect it. The steps below work for most Wi-Fi and Ethernet adapters on Windows 10 and 11.
What Code 31 Means
Code 31 is a Device Manager error that appears when Windows recognizes the hardware but cannot start it because a previous driver instance is still loaded in memory. The full message is: "This device is not working properly because Windows cannot load the drivers required for this device." It is different from Code 28 (no driver installed) or Code 43 (hardware failure). Code 31 specifically points to a software conflict, not a dead card.
Common Causes
- An incomplete driver update left a stale driver file in memory.
- A previous uninstall did not remove the driver package fully.
- Windows Update installed a driver that conflicts with the manufacturer's driver.
- Third-party security software or a VPN driver interfered with the network adapter.
- Corrupted system files after a crash or forced shutdown.
Fix 1: Uninstall and Reinstall the Adapter
- Press Windows + X and select Device Manager.
- Expand Network adapters.
- Right-click the adapter with the yellow exclamation mark and choose Uninstall device.
- In the confirmation dialog, check Delete the driver software for this device if the option appears.
- Click Uninstall.
- Restart your computer. Windows will reinstall the driver automatically.
If the error persists after restart, try the next fix.
Fix 2: Use the Hidden Device Manager View
Sometimes the stuck driver instance is not visible in the normal view. To see it:
- In Device Manager, click View and select Show hidden devices.
- Expand Network adapters again. Look for a grayed-out or faded adapter.
- Right-click that ghost adapter and choose Uninstall device.
- Restart your PC.
This clears the "previous instance" that Code 31 complains about.
Fix 3: Update or Roll Back the Driver
If reinstalling does not help, the driver itself may be outdated or recently updated to a bad version.
- Update: Right-click the adapter, select Update driver, then Search automatically for drivers. If Windows finds nothing, go to the manufacturer's support site and download the latest driver for your exact model.
- Roll back: If the error started after a driver update, go to the Driver tab, click Roll Back Driver, and restart.
Fix 4: Clear the Driver Cache via Command Prompt
If the above fails, you can clear the driver cache manually. This removes all leftover driver packages, including the stuck one.
- Open Command Prompt as Administrator (type cmd in Start, right-click, and select Run as administrator).
- Type
pnputil /enum-driversand press Enter. This lists all third-party drivers. - Look for entries with "oem" in the name that correspond to your network adapter. Note the Published Name (e.g.,
oem42.inf). - Type
pnputil /delete-driver oem42.inf /uninstalland press Enter. Replaceoem42.infwith the correct file. - Restart your PC.
This is more aggressive and should be done carefully, but it is a standard Microsoft tool.
Fix 5: Run the Network Troubleshooter and SFC
Windows has built-in tools that can repair driver-related problems.
- Go to Settings > System > Troubleshoot > Other troubleshooters and run the Network Adapter troubleshooter.
- Open Command Prompt as Administrator and run
sfc /scannowto check for corrupted system files. This can take a few minutes.
If the troubleshooter finds nothing and SFC reports no issues, the problem is likely a leftover driver instance, so repeat Fix 2.
Frequently Asked Questions
Will Code 31 damage my network adapter?
No. Code 31 is a software error. The hardware is fine. It means Windows cannot start the device due to a driver conflict. Once the driver is properly loaded, the adapter will work normally.
Why does Code 31 keep coming back after I reinstall?
This usually means a ghost device is still present. Use the hidden devices view (Fix 2) to uninstall the grayed-out adapter. If that doesn't work, the manufacturer's driver may be incompatible with your Windows version, so try an older driver or the generic Microsoft driver.
Can I fix Code 31 without restarting?
Sometimes. After uninstalling the adapter, you can click Action > Scan for hardware changes in Device Manager instead of restarting. However, a restart is more reliable because it clears the memory that holds the old driver instance.
Is it safe to use the pnputil command?
Yes, if you only delete the driver for your network adapter. Do not delete drivers you are unsure about, as that could affect other devices. The command is a standard Windows tool for managing driver packages.
What if none of these fixes work?
If Code 31 persists after trying all fixes, the issue may be a deeper Windows system corruption. You can try a system restore to a point before the error, or use the Reset this PC option in Settings (which keeps your files). If the adapter still fails after a clean Windows install, the hardware itself may be faulty.