IDE V2.0.0 fails to upload to ESP8266 via OTA

I am attempting to update OTA to an ESP8266 (NodeMCU 1.0). This worked fine in version 1.8.2 before upgrade. Now I am getting the error "The system cannot find the file specified." I checked that my port is set to the network address properly:

image

Here is the full error output:

Executable segment sizes:

IROM   : 302224          - code in flash         (default or ICACHE_FLASH_ATTR) 

IRAM   : 29368   / 32768 - code in IRAM          (ICACHE_RAM_ATTR, ISRs...) 

DATA   : 1344  )         - initialized variables (global, static) in RAM/HEAP 

RODATA : 1636  ) / 81920 - constants             (global, static) in RAM/HEAP 

BSS    : 27056 )         - zeroed variables      (global, static) in RAM/HEAP 

Sketch uses 334572 bytes (32%) of program storage space. Maximum is 1044464 bytes.
Global variables use 30036 bytes (36%) of dynamic memory, leaving 51884 bytes for local variables. Maximum is 81920 bytes.
esptool.py v2.8
Serial port 192.168.1.226
Traceback (most recent call last):
  File "C:\Users\Josh\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4/tools/upload.py", line 65, in <module>
    esptool.main(cmdline)
  File "C:/Users/Josh/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/2.7.4/tools/esptool\esptool.py", line 2889, in main
    esp = chip_class(each_port, initial_baud, args.trace)
  File "C:/Users/Josh/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/2.7.4/tools/esptool\esptool.py", line 237, in __init__
    self._port = serial.serial_for_url(port)
  File "C:/Users/Josh/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/2.7.4/tools/pyserial\serial\__init__.py", line 88, in serial_for_url
    instance.open()
  File "C:/Users/Josh/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/2.7.4/tools/pyserial\serial\serialwin32.py", line 62, in open
    raise SerialException("could not open port {!r}: {!r}".format(self.portstr, ctypes.WinError()))
serial.serialutil.SerialException: could not open port '192.168.1.226': FileNotFoundError(2, 'The system cannot find the file specified.', None, 2)
Failed uploading: uploading error: exit status 1

Hi @josh84. Thanks for your report.

In order to gather more information that might help us to troubleshoot your problem, I'm going to ask you to post the full output from the upload when in verbose mode.

:exclamation: NOTE: These instructions will not solve the problem. They are only intended to possibly gather some more information about the problem, which might provide a clue that leads to a solution.

Please do this:

  1. Select File > Preferences from the Arduino IDE menus.
  2. Uncheck the checkbox next to Show verbose output during: compilation
  3. Check the checkbox next to Show verbose output during: ☐ upload.
  4. Click the OK button.
  5. Attempt an upload, as you did before.
  6. Wait for the upload to fail.
  7. You will see a "Upload error: ..." notification at the bottom right corner of the Arduino IDE window. Click the COPY ERROR MESSAGES button on that notification.
  8. Open a forum reply here by clicking the Reply button.
  9. Click the </> icon on the post composer toolbar.
    This will add the forum's code block markup (```) to your reply to make sure the error messages are correctly formatted.
    Code block
  10. Press Ctrl+V.
    This will paste the error output from the upload into the code block.
  11. Move the cursor outside of the code tags before you add any additional text to your reply.
  12. Click the Reply button to post the output.

Thanks for the reply. I have done as you've asked, but it does not look like it changed much. Either way, here's the output:

Executable segment sizes:

IROM   : 302224          - code in flash         (default or ICACHE_FLASH_ATTR) 

IRAM   : 29368   / 32768 - code in IRAM          (ICACHE_RAM_ATTR, ISRs...) 

DATA   : 1344  )         - initialized variables (global, static) in RAM/HEAP 

RODATA : 1636  ) / 81920 - constants             (global, static) in RAM/HEAP 

BSS    : 27056 )         - zeroed variables      (global, static) in RAM/HEAP 

Sketch uses 334572 bytes (32%) of program storage space. Maximum is 1044464 bytes.
Global variables use 30036 bytes (36%) of dynamic memory, leaving 51884 bytes for local variables. Maximum is 81920 bytes.
"C:\Users\Josh\AppData\Local\Arduino15\packages\esp8266\tools\python3\3.7.2-post1/python3" "C:\Users\Josh\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4/tools/upload.py" --chip esp8266 --port "192.168.1.226" --baud "115200" ""  --before default_reset --after hard_reset write_flash 0x0 "C:\Users\Josh\AppData\Local\Temp\arduino-sketch-CFCE7305B901734FF557B3A09C7E760C/esp32_gps_ntp_server.ino.bin"
esptool.py v2.8
Serial port 192.168.1.226
Traceback (most recent call last):
  File "C:\Users\Josh\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4/tools/upload.py", line 65, in <module>
    esptool.main(cmdline)
  File "C:/Users/Josh/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/2.7.4/tools/esptool\esptool.py", line 2889, in main
    esp = chip_class(each_port, initial_baud, args.trace)
  File "C:/Users/Josh/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/2.7.4/tools/esptool\esptool.py", line 237, in __init__
    self._port = serial.serial_for_url(port)
  File "C:/Users/Josh/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/2.7.4/tools/pyserial\serial\__init__.py", line 88, in serial_for_url
    instance.open()
  File "C:/Users/Josh/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/2.7.4/tools/pyserial\serial\serialwin32.py", line 62, in open
    raise SerialException("could not open port {!r}: {!r}".format(self.portstr, ctypes.WinError()))
serial.serialutil.SerialException: could not open port '192.168.1.226': FileNotFoundError(2, 'The system cannot find the file specified.', None, 2)
Failed uploading: uploading error: exit status 1

That provided me with the information I was looking for.

I am able to reproduce the problem when using the version 2.7.4 of the ESP8266 Arduino boards platform like you are. However, when I use the latest version 3.0.2, OTA uploads work perfectly.

So, unless you have a specific reason you can't update, I will recommend you to update to the latest version of the platform. I'll provide instructions:

  1. Select File > Preferences from the Arduino IDE menus.
  2. Enter the following URL into the "Additional Boards Manager URLs" field (if it is not already present):
    https://arduino.esp8266.com/stable/package_esp8266com_index.json
    
    If there are already Boards Manager URLs in the field, separate them with commas.
  3. Click the OK button.
  4. You will now see a "Downloading index: ..." notification at the bottom right corner of the IDE window. Wait for that notification to close.
  5. Select Tools > Board > Boards Manager from the Arduino IDE menus to open the "Boards Manager" view in the left side panel.
  6. Scroll down through the list of boards platforms until you see the "esp8266 by ESP8266 Community" entry. Hover the mouse pointer over
  7. You will now see a version menu and an "INSTALL" button appear at the bottom of the entry. Make sure the version menu shows "3.0.2".
  8. Click the "INSTALL" button.
  9. Wait for the installation to finish.

Now try the OTA upload again. Hopefully it will work this time.


Please let me know if you have any questions or problems while following those instructions.

This is not that arduino related but may help.. maybe

I got the same error "Could not open port - The system cannot find the file specified" quite recently in visual studio while coding a C# program which communicates with arduinos over the serial port.
I found out it was caused by me having changed the COM port number manually using the device manager. After a reboot I didn't get this anymore but could reproduce it if I manually changed the COM port number again. This is in windows 10 by the way. Could be a bug in how windows handles serial ports.

I have to say that I'm such a newbie that I'm not familiar with using a serial port over the network :sweat_smile:. But maybe it's related. At least the error message is exactly the same.

Thank you! That did it. For some reason, my board manager URL field was blank. I am now running on 3.0.2 and it uploaded just fine.

You are welcome. I'm glad it is working now.

Arduino IDE 1.x and 2.x use separate preference stores so you must manually transfer any custom preferences you need such as "Additional Boards Manager URLs" from Arduino IDE 1.x to 2.x.

There is a plan to add a feature in a future release that will allow the IDE to notify the user of any missing URLs:

Unfortunately that didn't get finished before the 2.0.0 release, so for now we will have to spread this knowledge through the Arduino IDE 2.x user community. The IDE still recognizes the boards platforms fine without the index, but the URL is required to get notifications of available updates so it becomes more of a problem as time goes on.

That makes total sense. Yeah I missed that note, probably needed to RTFM on it :sweat_smile:

Not to hijack my own thread but... is there a plan to, as part of the install process, populate 2.0's settings store from 1.x's data?

We did discuss it. Most of the settings (e.g., "Interface scale", "Language") are evident just from using the IDE. The only exceptions are "Sketchbook location" and "Additional Boards Manager URLs". Since "Sketchbook location" uses the same default as Arduino IDE 1.x, it is likely most users won't be affected. That leaves "Additional Boards Manager URLs". The plan to make the IDE notify the user about the missing URLs was the result of that discussion.

The work to implement and maintain that feature has ongoing benefits beyond just the migration period because we have seen that users will sometimes not realize that the URLs are needed after the installation is finished and replace the old URL with a new one instead of adding to the list. In Arduino IDE 1.x, the removal of the URL resulted in the previous platform disappearing from the Tools > Board menu, so at least the user had a signal that something went wrong with the platform even if they didn't correlate that with the preference change they made. But with the new resilient system used by Arduino IDE 2.x, there is no indication of an effect of the missing URL other than the missing updates.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.