How to Fix ‘Windows Cannot Load the Device Driver (Code 38)’

Plugging in a USB flash drive, external hard disk, audio interface, or gaming controller only to find the device unresponsive while Device Manager marks it with a yellow exclamation mark and error Code 38 disrupts computer productivity. The accompanying notification reads: “Windows cannot load the device driver for this hardware because a previous instance of the device driver is still in memory (Code 38)”. This error indicates that when the device was unplugged or suspended, its kernel-mode driver failed to unload cleanly from system RAM. When the device reconnects, Windows refuses to load a secondary driver instance to prevent memory address collisions. Resolving this issue involves disabling Fast Startup, purging ghost devices, and resetting USB root controllers.

Perform a Full Cold Restart to Clear Stuck Kernel Drivers

Standard Windows 11 shutdowns write the current kernel memory state to the hard drive via Fast Startup rather than flushing RAM completely. A true restart is required to purge stuck drivers.

  1. Disconnect the affected USB peripheral from your computer.
  2. Click the Start button, click the Power icon, and select Restart (do NOT select “Shut down”).
  3. Alternatively, open Command Prompt and execute a forced cold restart:
    shutdown /r /f /t 0
  4. Once Windows boots back to the desktop, plug the device into a different USB port. Windows will load a pristine driver instance into memory without Code 38 conflicts.

Disable Fast Startup to Prevent Driver Memory Freezes

Fast Startup preserves corrupted driver session states across power cycles, causing Code 38 to recur on subsequent boots.

  1. Press Windows Key + R, type control, and press Enter to open the Control Panel.
  2. Set View by to Large icons and select Power Options.
  3. Click Choose what the power buttons do in the left sidebar.
  4. Click Change settings that are currently unavailable.
  5. Under the Shutdown settings section at the bottom, uncheck the box for Turn on fast startup (recommended).
  6. Click Save changes. Windows will now unload all hardware drivers completely on every shutdown.

Remove Ghost and Hidden Devices in Device Manager

Orphaned driver instances from previous connections remain registered as hidden devices in Windows Device Manager, locking hardware resources.

  1. Press Windows Key + X and select Device Manager.
  2. Click on the View menu at the top and check Show hidden devices.
  3. Expand the category corresponding to your problematic hardware (e.g. Universal Serial Bus controllers or Disk drives).
  4. Look for duplicate or translucent greyed-out device entries.
  5. Right-click each greyed-out duplicate entry and select Uninstall device.
  6. Locate the device actively throwing Code 38, right-click it, and select Uninstall device.
  7. Click Action > Scan for hardware changes to reinstall clean driver hooks.

Reinstall USB Host Controller Drivers

Corrupted USB root hub enumeration routines can fail to signal driver unloading upon physical device detachment.

  1. In Device Manager, expand the Universal Serial Bus controllers category.
  2. Right-click your USB 3.0 eXtensible Host Controller and select Uninstall device.
  3. Your mouse and keyboard may temporarily lose power for several seconds.
  4. Restart your computer using your PC’s physical power button (or press Alt + F4 > Restart). Windows will reinstall the host controller driver automatically upon boot.

Run the Windows Hardware and Devices Troubleshooter

Microsoft includes an automated diagnostic tool designed to detect driver unloading deadlocks.

  1. Press Windows Key + R, paste the following command, and press Enter:
    msdt.exe -id DeviceDiagnostic
  2. Click Next to allow the wizard to scan connected hardware and resolve driver memory allocation locks.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.