esptool "Invalid head of packet: Possible serial noise or corruption"

esptool expected a packet starting with 0xC0 and got something else. The link works enough to carry bytes, but not cleanly.

A fatal error occurred: Invalid head of packet (0x46): Possible serial noise or corruption.

Related messages from the same part of esptool: Packet content transfer stopped (received 8 bytes) and Serial data stream stopped: Possible serial noise or corruption., when the stream breaks off in the middle of a packet.

The usual causes

From Espressif's troubleshooting guide:

Try

Download mode, and the pin that selects it

esptool can only flash a chip that has started in its ROM's download mode. The chip decides at reset, from a strapping pin:

Development boards do this for you: esptool pulses the serial chip's DTR and RTS lines, which a two-transistor circuit turns into GPIO0 and EN. Boards with the chip's built-in USB (USB-Serial/JTAG on the C3, S3, C6 and others) do it over USB without that circuit. To do it by hand: hold BOOT, press and release EN (or RST), then release BOOT, and start the upload.

Try it from the browser

To rule out the computer's setup (drivers, Python, the IDE's settings), try the free ESP32 web flasher in Chrome or Edge: it uses the same ROM protocol over WebSerial and needs nothing installed. If it cannot connect either, the problem is the board, the cable or the boot mode.

And once a device is flashed and installed somewhere, you should not need a cable again: Pinscope updates the firmware over the internet, with a rollback if the new build does not come back. OTA over the internet.

Related errors: Failed to connect to ESP32 · Wrong boot mode detected · Brownout detector was triggered · Could not open port, the port is busy. All ESP32 errors: the list. Messages from esptool's source (loader.py); causes from Espressif's esptool Troubleshooting guide.

More