ESP_ERR_OTA_VALIDATE_FAILED (0x1503)
The OTA functions checked the image and rejected it before it could be booted. The documentation of esp_ota_write and esp_ota_end says when, and each case has its own fix.
ESP_ERROR_CHECK failed: esp_err_t 0x1503 (ESP_ERR_OTA_VALIDATE_FAILED) at 0x400d2a4f file: "./main/main.c" line 42 func: app_main expression: …
ESP_ERR_OTA_VALIDATE_FAILED (0x1503). ESP-IDF's description: Error if OTA app image is invalid.
When it is returned
- From
esp_ota_write: the first byte of the image is not the app image magic byte. The file is not an application image. - From
esp_ota_end: the image is not a valid app image, or, with secure boot enabled, its signature did not verify.
The usual causes
- The wrong file: a merged binary (bootloader, partition table and app in one), a bootloader, or a filesystem image, instead of the application
.bin. In ESP-IDF it isbuild/<project>.bin; in Arduino it is the sketch's.ino.bin, not.merged.bin. - A truncated or corrupted download: the connection dropped, or an HTTP error page was written as if it were the image. Check the HTTP status and the length before writing.
- Built for another chip: an image for an ESP32-S3 sent to an ESP32-C3.
- Secure boot: the image was not signed, or signed with another key.
The free ESP32 firmware inspector shows what a .bin is: app or merged image, chip, version and ESP-IDF version, in the browser. Pinscope's OTA updates check the same things before sending an image to a device: OTA over the internet.
Related errors: ESP_ERR_NVS_NO_FREE_PAGES · ESP_ERR_NO_MEM · esp_err_t codes. All ESP32 errors: the list. Codes and descriptions from ESP-IDF's headers; behaviour from the API documentation of the functions named. ESP-IDF's Error Handling guide.
More
- Remote access to an ESP32 without TLS: what it measured and what it costs
- Reaching an ESP32 web server from outside its network
- Updating ESP32 firmware over the internet, with rollback
- Guru Meditation Error: decoding the backtrace, and crashes from the field
- Remote logging: ESP_LOG without a serial cable
- Heap and stack monitoring in the field
- An ESP32 behind CGNAT, 4G or Starlink
- TLS memory usage on the ESP32, and how to reduce it
- Sharing an ESP32 sensor page with anyone, without port forwarding
- ArduinoOTA over the internet, with a rollback
- ESP32 remote access compared: port forwarding, ngrok, Cloudflare Tunnel, Tailscale
- esp_http_server slow? The 250 ms delay and the fix
- Before the first ESP32 ships: a field support checklist
- ESP32 exception decoder: a Guru Meditation backtrace to lines, in the browser