A fatal error occurred: Failed to connect to ESP32

  • ESP32
  • ESP8266

You may see

A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header
A fatal error occurred: Failed to connect to ESP32: No serial data received.
Wrong boot mode detected (0x13)! The chip needs to be in download mode.
Connecting........_____....._____

Why it happens

  • The board didn't switch to download mode.
  • A charge-only cable, the wrong port, or another program using the port.
  • Parts wired to GPIO 0, 2, 12, 15, RX or TX hold the board in the wrong mode.

How to fix it

  1. Press Upload. When you see "Connecting…", hold the BOOT button until writing starts.
  2. Take all wires off the board and try again.
  3. Check the port and try another cable, straight into the computer.
  4. Close the Serial Monitor.
  5. Lower Tools > Upload Speed to 115200.

It worked if: The last lines are "Hash of data verified" and "Hard resetting via RTS pin…".

From the official documentation. Wording from the esptool 4.8 source and Espressif's troubleshooting page. Sources: Arduino ESP32: troubleshooting, Espressif esptool: troubleshooting.

Didn't help? Search another error or ask us.