I play with my Arduino daily. And I get this error message at least once a day. I can upload 4 programs successfully and magically on the 5th time it happens. I run Arduino IDE 2.0.0 Beta.9
avrdude: ser_open(): can't set com-state for "\\.\COM3" Upload error: Error: 2 UNKNOWN: uploading error: uploading error: exit status 1
I then go to Windows 10 --> device manager --> universal serial bus controllers --> and "update" drivers with the existing already installed driver --> restart my computer --> reorganize all my stuff after a reboot
Most of the time my quest ends there, but occasionally I have to pull the USB out and plug it back in for good measure. I've seen this error since 2015 in the forum (that thread was closed 4 years later with no real answer), but don't ever see a satisfactory answer that would fix this error so it never, ever, ever happens again.