Wrong port for upload - AutoDetect fails

Just today, my IDE PlatformIO on Visual Studio Code(W10) cannot download the code. It picks wrong COM port number - even that port is occupied. I hav arduin o Com2. Before - regardless Arduino COm port was - it was always found.
Looking for upload port…

  • Auto-detected: COM4*
  • Forcing reset using 1200bps open/close on port COM4*
  • Waiting for the new upload port…*
  • Uploading .pio\build\nano33ble\firmware.bin*
  • No device found on COM4*

Can you see if setting upload_port = COMx with the right COM port number in the platformio.ini helps in this case? (docs)

Yes, it works. But Auto detection worked for me for long until today.It was very convenient feature.

Please file an issue in Issues · platformio/platformio-core · GitHub with the exact situation of COM ports and how they’re used at the moment of uploading.