OTA upload to esp8266 not working

Has anyone had success using OTA with Arduino IDE 2.0 beta 12? I get a connection error when I select the network port, but no information that tells me what the error actually is. I am using OTA code that works in IDE 1.x. The 8266 is in STA mode and the OTA setup code shows the ip address that is in the port select pulldown, but the port will not connect.

@strickce's formal bug report to the IDE developers is here:

Thanks for bringing that to our attention!


I think there is an important comment in that issue:

if I stop the serial monitor and restart it, the error message goes away.

If I understand correctly, the problem is that the Serial Monitor is handling the network port selection incorrectly. It is normal (though perhaps not ideal UX?) that if you have Serial Monitor open and disconnect the serial port (e.g., unplug the Arduino board USB cable from your computer), then you get these repeated notifications about the failure to reconnect to the serial port. Like this:

Sorry I wasn't as clear as I wanted to be. I'll give you my setup, then go through the steps that lead to the problem.
I have a sketch that contains an asynchronous web server that I use to control some lighting. It turns out that the web server and the OTA code cannot run together. Therefore, I did what many others have done and use a flag in EEPROM to control how the program boots. If the flag is off, the web server code boots and the web page is served. There is an OTA button on the page that, when pushed, writes the OTA flag "on" in EEPROM and then causes a reboot of the 8266. This time, the boot reads the flag and causes the OTA code to run. When that code runs, it causes the IDE to recognize that there is a network port at the address of the 8266.

At this time, the serial monitor has shown the print statements from the OTA code and everything there looks normal.
Now I select the network port and the error happens. Im on a mac and see the yellow error banner and to the lower right of the serial monitor window, the two messages as in your reply. Then, if I go back and select the serial port again, the serial monitor does not change, even if I reload the sketch using the serial port. This block serial output from the running sketch until I stop the serial monitor and restart it. That is the only way I know of that I can stop the error messages from flashing.

After all of that, I must admit that this is not a very serious problem. I could just recycle the serial monitor when I get this kind of error.

btw, the subject line references an Arduino forum post I made about the connection problem itself. Based on what I hear from other users, I may open another issue about that. Or should I not, since you already know about it?