Getting "Please specify upload_port" even when only building

I tried changing from …

upload_port   = COM[3]
upload_speed  = 921600

… to …

upload_protocol = espota
upload_port     = 192.168.1.199

… and I’m still getting “Please specify upload_port” even when only building. How do I fix this?

Full platformio.ini and output?

Thanks. Enjoy …

; PlatformIO Project Configuration File
;
;   Build options: build flags, source filter
;   Upload options: custom upload port, speed and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html


[env:esp12e]
platform = espressif8266
board = esp12e
framework = arduino

upload_protocol = espota
upload_port     = 192.168.1.199  // ???

; upload_port   = COM[3]
; upload_speed  = 921600

monitor_port  = COM[3]
; monitor_speed =  74880
; monitor_speed = 115200
monitor_speed = 921600
monitor_filters = log2file, esp8266_exception_decoder, default, time
; monitor_filters = esp8266_exception_decoder, default

monitor_rts = 0
monitor_dtr = 0
board_build.filesystem = littlefs
board_build.f_cpu = 160000000L
build_type = release
build_flags = 
	-Wunused-variable
	-Wdeprecated-declarations

lib_deps = 
	links2004/WebSockets@^2.3.6
	jandrassy/TelnetStream@^1.2.2
	khoih-prog/ESP8266TimerInterrupt@^1.6.0

extra_scripts = download_fs.py

Processing esp12e (platform: espressif8266; board: esp12e; framework: arduino)
-----------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/esp12e.html
PLATFORM: Espressif 8266 (4.0.1) > Espressif ESP8266 ESP-12E
HARDWARE: ESP8266 160MHz, 80KB RAM, 4MB Flash
PACKAGES:
 - framework-arduinoespressif8266 @ 3.30002.0 (3.0.2)
 - tool-esptool @ 1.413.0 (4.13)
 - tool-esptoolpy @ 1.30000.201119 (3.0.0)
 - toolchain-xtensa @ 2.100300.210717 (10.3.0)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 38 compatible libraries
Scanning dependencies...
Dependency Graph
|-- WebSockets @ 2.3.7
|   |-- Hash @ 1.0
|   |-- ESP8266WiFi @ 1.0
|   |-- Ethernet @ 2.0.0
|   |   |-- SPI @ 1.0
|   |-- SPI @ 1.0
|-- TelnetStream @ 1.2.2
|   |-- ESP8266WiFi @ 1.0
|   |-- Ethernet @ 2.0.0
|   |   |-- SPI @ 1.0
|-- ESP8266TimerInterrupt @ 1.6.0
|-- Wire @ 1.0
|-- LittleFS @ 0.1.0
|-- ESP8266mDNS @ 1.2
|   |-- ESP8266WiFi @ 1.0
|-- ESP8266WebServer @ 1.0
|   |-- ESP8266WiFi @ 1.0
|-- ESP8266WiFi @ 1.0
|-- ArduinoOTA @ 1.0
|   |-- ESP8266WiFi @ 1.0
|   |-- ESP8266mDNS @ 1.2
|   |   |-- ESP8266WiFi @ 1.0
Building in release mode
Error: Please specify `upload_port` for environment or use global `--upload-port` option.
For some development platforms it can be a USB flash drive (i.e. /media/<user>/<device name>)
=========================== [FAILED] Took 3.15 seconds ===========================

 *  The terminal process "C:\Users\mark\.platformio\penv\Scripts\platformio.exe 'run'" terminated with exit code: 1. 
 *  Terminal will be reused by tasks, press any key to close it. 

This script unconditionally tries to do an autodetection when it’s loaded.

Comment out the extra_scripts line from the platformio.ini with a ; and retry as a first test.

Thanks for the fast response. That fixed it. I assumed the script was run after a build. In any case the script doesn’t work so the fix is no problem.