Upload_port ignored in platformio.ini

This was working fine with auto detect for the upload port until I plugged something in which created a COM3 port. That COM3 port is gone now but the uploader keeps trying to use it. The correct port is COM17. I added upload_port to the .ini file to force it but it still ignores it and tries COM3 then fails with the error:

CURRENT: upload_protocol = esptool
Looking for upload port…
Using manually specified: COM3
Uploading .pio\build\esp32dev\firmware.bin
esptool.py v4.5.1
Serial port COM3

A fatal error occurred: Could not open COM3, the port doesn’t exist
*** [upload] Error 2

It shouldn’t be manually specified as COM3 (and never was). No matter what I try, it refuses to try COM17. Ato detection was working just fine until this mysterious COM3 showed up.

lib_ldf_mode = deep+
platform = espressif32@^6.3.2
board = esp32dev
framework = arduino
upload_protocol = esptool
upload_port = COM17
debug_tool = esp-prog
monitor_speed = 115200
monitor_echo = true
build_type = release

This seems to have been this issue: https://docs.platformio.org/en/latest/integration/ide/vscode.html#project-tasks