Weird problem with win10 and usb to serial port

Just started having a weird issue with the serial port monitoring. If it’s connected to the esp8266 chip thru a standard usb to serial (eg. FTDI232) and I reboot the chip I get the following in the terminal window and it closes. If I close vscode, disconnect, then reconnect and open arduino and open the serial port it’s fine again, then I reopen PIO and the serial port is fine again for awhile.

Traceback (most recent call last):
File “C:\Users\Bill.platformio\python27\Lib\threading.py”, line 801, in __bootstrap_inner self.run()
File “C:\Users\Bill.platformio\python27\Lib\threading.py”, line 754, in run self.__target(*self.__args, **self.__kwargs)
File “c:\users\bill.platformio\penv\lib\site-packages\serial\tools\miniterm.py”, line 445, in reader data = self.serial.read(self.serial.in_waiting or 1)
File “c:\users\bill.platformio\penv\lib\site-packages\serial\serialwin32.py”, line 257, in in_waiting raise SerialException(“ClearCommError failed ({!r})”.format(ctypes.WinError()))
SerialException: ClearCommError failed (WindowsError(5, ‘Access is denied.’))

Any help would be great! When it displays this weirdness the serial port monitor closes/crashes. I can reopen and it works fine until I reboot the device, and then same issue.

Exact same problem on Adafruit Feather M0. Identical serial output except for last line of output. For me,the last kine of the error message is:
SerialException: ClearCommError failed (WindowsError(22, ‘The device does not recognize the command.’))

The device then crashes and restarts…

HELP!!

Have now determined that the error occurs when the MCU resets while a connection to the Serial Monitor is active.
Now I just have to find out why my code keeps restarting…

I had the same problem. Did you figure out why the code keeps resetting? I am currently writing a program in which on receive interrupt from the MCU, the MCU gets disconnected and I get the above error. Please help me to solve this issue.

I have the same problem with my Arduino Nano under win11. When I use the reset button of the Nano, it breaks the USB serial link with the same above SerialException.