I get “Error Opening Sound Device” when Audacity preferences are set to HeadPhones and the headphone jack is subsequently unplugged, even after plugging the headphones back in again, as if it fails to recognize that the headphones have been reconnected. This error consistently happens. I have tried to switch preferences to internal speakers and back to headphones but the problem is not fixed until you quit Audacity and restart it with the headphones already connected, which is annoyingly disruptive when in the middle of a large project. Applications other than Audacity work with no problem and also correctly switch automatically from internal to headphones according to whichever device is connected.
Audacity version 3.3.2 on Macbook Pro 16" 64GB Ram, Apple M1 Max. OS macOS Monterey v12.2