Failed to connect to ESP32: Invalid head of packet (0x1B)

I’m trying to flash ESPHome onto this Nodemcu-32S board. I go through all the normal steps to flash the device but end up with this error:

A fatal error occurred: Failed to connect to ESP32: Invalid head of packet (0x1B)
*** [upload] Error 2

I’ve tried 3 different times. I’ve tried rebooting HA, and erasing then reinstalling the ESPhome config for the device. When the Nodemcu-32s is plugged in to the USB port the LED on the board is red, in case that matters.

Any ideas how to get past this?

Have you tried holding down the button while flashing?

Welp, I feel like an idiot. I had no idea you had to hold down the button. That should be added to the ESPhome documentation. That worked.

1 Like

I have never had an esp32 that needed that, but it was on the amazon page you bought it from :slight_smile: See the review from Edward Smith

1 Like

What works for me a little bit more specific, The button “BOOT”, and it is enough to press and hold at the moment when uploading to USB is mentioned:


Be patient and when using OTA take care of good environment for the ESP antenna.

(my device: ESP-WROOM-32)

1 Like

works like a charm. thank u so much