Fix “A serial exception error occurred: Write timeout” (ESP32)
esptool could not push bytes to the USB port in time. Usually a native-USB ESP32-C3/S3 that crashed or slept, a flaky cable, or a CH340 wedged after a crash.
Community draft — report a mistake
What you see
esptool.py v4.8.1
Serial port COM9
Connecting...
A serial exception error occurred: Write timeout
Note: This error originates from pySerial. It is likely not a problem with esptool, but with the hardware connection (e.g. range extenders, USB hubs) or drivers.
For troubleshooting steps visit: https://docs.espressif.com/projects/esptool/en/latest/troubleshooting.html
Failed uploading: uploading error: exit status 1esptool.py v4.8.1 Serial port COM9 Connecting... A serial exception error occurred: Write timeout Note: This error originates from pySerial. It is likely not a problem with esptool, but with the hardware connection (e.g. range extenders, USB hubs) or drivers. For troubleshooting steps visit: https://docs.espressif.com/projects/esptool/en/latest/troubleshooting.html Failed uploading: uploading error: exit status 1
“Write timeout” comes from pySerial, the library esptool uses to talk to the port. The operating system opened the port, but the bytes esptool sent never drained. Nothing on the other end was reading.
On boards with native USB (ESP32-C3, ESP32-S3, XIAO) that is usually your own sketch: if it crashed, slept or took over the USB pins, the port exists but nobody is listening. Putting the chip into download mode by hand takes your sketch out of the picture.
Quick fix — try in order
- 1
Force download mode by hand
Hold BOOT (GPIO9 on C3, GPIO0 on S3/ESP32), tap RESET (or plug in USB while holding BOOT), release BOOT. Re-select the COM port — it may have a new number — and upload.
- 2
Unplug, wait five seconds, replug
A crashed sketch can leave the USB-CDC endpoint half-alive so writes never complete. A cold power cycle clears it.
- 3
Plug straight into the PC with a short data cable
Hubs, extension leads and front-panel ports are the next most common cause. Use a rear USB port.
- 4
Close anything else that opened the port
Serial Monitor, Serial Plotter, Thonny or a browser tab using Web Serial can hold the port and stall writes.
- 5
Fix the sketch that kills USB
Sketches that deep-sleep, reboot in a loop or reuse GPIO18/19 (C3) or GPIO19/20 (S3) take the native USB port away. Once in download mode, upload a plain Blink first.
Why it happens
Why mostly on ESP32-C3 and ESP32-S3?
These chips have USB built in (USB-Serial/JTAG). If your running sketch crashes, sleeps or reuses the USB pins, the computer still sees a port but nothing on the chip answers, so the write times out.
Is this a driver problem?
Sometimes. On Windows a CH340 that was yanked out mid-transfer can stay stuck until replugged, and very old CH340 drivers time out at high baud rates. Update the driver from the WCH site if replugging does not help.
Power bank or laptop on battery
Weak USB power makes the board brown out mid-upload and drop off the bus. Try a laptop on charge or a desktop port.
Board-specific notes
XIAO ESP32C3 / ESP32S3: Tiny BOOT and RESET buttons: hold BOOT, plug in the cable, then release. The board stays in download mode until you press RESET. See the XIAO ESP32C3 page.
ESP32-C3 SuperMini: Same procedure — hold BOOT, plug in, release. After uploading press RESET, because esptool cannot leave download mode over native USB.
Drivers — official sources only
Did this fix it?
Thanks — that helps us keep this page right.