| Previous | Next |
| ERROR_ACTIVE_CONNECTIONS | ERROR_UNKNOWN_PRINT_MONITOR |
ERROR_DEVICE_IN_USE
Open or active use prevented the device from being disconnected
Orderly PnP removal starts with a query so drivers and registered consumers can decide whether the device can be removed safely. A stack can refuse removal while active operations or critical usage make disconnection disruptive. This status reports the externally visible “in use” condition rather than a timeout in the driver stack.
Identify which handle or workload is holding the device. Stop new I/O, close application handles, and let the stack drain outstanding requests before repeating the disconnect. For driver code, remove locks are a standard way to count outstanding I/O during teardown, but the driver must also stop accepting new work after entering remove-pending state. Do not force-detach a kernel device object to work around user activity; that bypasses the PnP lifecycle and risks use-after-remove bugs.
What to inspect
- Enumerate processes or services with open handles to the device interface.
- Stop new I/O and wait for pending requests to drain before retrying removal.
- For drivers, verify remove-pending state blocks new hardware-dependent work.
References
- Microsoft: IRP_MN_QUERY_REMOVE_DEVICE
- Microsoft: handling query-remove
- Microsoft: removing a device in a function driver
Looking for a different code? Search another status or error code.