The Image Scanner suddenly stopped working with the error: "Failed to open a connection to the device (-21345)." I'm on a Mac, wirelessly connected to an HP8600. Rebooting the printer didn't help. - Apple Community
"Failed to open a connection to the device (-21345)" appears when scanning wirelessly. Network is unchanged, printing works, but the macOS scan dialog times out. - Reddit
You might suddenly encounter the error message: “Failed to Open a Connection to the Device (-21345)”. This frustrating issue often appears when your system or a specific application cannot communicate with a connected device, such as a smartphone, camera, USB accessory, or virtual hardware.
You're not alone if you see this error and don't know what it means or how to fix it. In this article, we'll walk you through proven solutions to get your Mac communicating with your device again.
Reconnect the device or use a different port
Physical connectivity issues are one of the most common reasons for the “Failed to Open a Connection to the Device (-21345)” error. The USB cable might be loose, the port may be faulty, or the device may have failed to power on properly.
You should first disconnect the device and then reconnect it. Try using a different USB or Thunderbolt port on your Mac to rule out port-specific issues.
If the problem persists, switch to another cable if available, as damaged or low-quality cables can disrupt communication. Additionally, some USB-C hubs on macOS can cause interference, so you can plug the device directly into your Mac to see if that resolves the issue.
Restart your Mac and the external device
Temporary system glitches or device firmware issues can block proper initialization. Restarting can clear caches and reset hardware bridges.
- Turn off your Mac and the device.
- Power them on again and try reconnecting.
- Wait 30 seconds after shutdown before turning them back on.
Share this method with others if you find it useful!
Check macOS Privacy and Security permissions
Since macOS 10.15 (Catalina), Apple has enforced strict security permissions (TCC). If the system doesn't allow an app to access the connected device, this error might occur.
Here is how to check macOS Privacy and Security permissions:
- Go to System Settings > Privacy & Security.
- Check permissions under Full Disk Access, Files and Folders, Camera, Microphone, Input Monitoring, or Developer Tools.
- Make sure the application trying to connect to the device is enabled.
Note: Apps installed from unidentified developers may not appear in these panels until you open them manually at least once.
Ensure the device is not being used by another application
A connected device can only be accessed by one program at a time. If another app (e.g., Android Studio, OBS, Final Cut Pro) is already using the device, connection attempts will fail.
How to do it:
- Quit other apps that might be using the device.
- Check Activity Monitor for background processes like adb, camera daemon, or disk processes.
- Force quit unneeded processes and try again.
Reset NVRAM/PRAM and SMC (for Intel Macs)
NVRAM (Non-Volatile Random-Access Memory) and PRAM (Parameter RAM) store low-level system settings such as volume, display resolution, and startup disk preferences.
SMC (System Management Controller) manages hardware-related functions like power, battery, fans, and sleep behavior. If these settings become corrupted or misconfigured, they can cause hardware communication issues, including errors like “Failed to Open a Connection to the Device (-21345).”
How to Reset NVRAM/PRAM:
- Shut down your Mac completely.
- Press and hold Option (⌥) + Command (⌘) + P + R, then turn on your Mac.
- Keep holding the keys for about 20 seconds, until the Apple logo appears a second time or you hear the startup chime again (depending on your Mac model), then release the keys.
How to Reset SMC (for Intel Macs):
MacBook with T2 chip: Shut down your Mac. Press and hold Control + Option (left side) + Shift (right side) together, then press and hold the power button as well. Hold all keys for 10 seconds, release them, and then turn on your Mac as usual.
iMac or Mac mini: Shut down the Mac and unplug the power cord. Wait for 15 seconds, plug it back in, wait a few more seconds, then power on the Mac.
Note: Apple Silicon Macs (M1, M2, M3) do not support manual NVRAM or SMC resets. These functions are handled automatically during a full shutdown. Simply shut down your Mac, wait 30 seconds, and then turn it back on.
Try on a different Mac user account or in Safe Mode
User-level configuration or startup items may conflict with device access. So, you can try to create a new user in System Settings > Users & Groups. Then, log in with the new user and test the device.
Alternatively, boot into Safe Mode by holding Shift while booting (Intel) or holding Power until “Loading Options” and selecting Safe Mode (Apple Silicon).
Share the above methods with more people to help them fix the problem!