When an ESPHome device crashes, misbehaves, or refuses to connect, the right tools can dramatically shorten the time from “something is wrong” to “it’s fixed.” This guide covers crash backtrace capture, stack trace decoding, verbose logging configuration, and solutions to the most common failure modes — Wi-Fi dropouts, OTA timeouts, out-of-memory errors, and watchdog resets.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/esphome/esphome.io/llms.txt
Use this file to discover all available pages before exploring further.
Getting Crash Backtraces
Automatic Crash Reporting (No USB Required)
ESPHome automatically captures crash backtraces and stores them across software resets on ESP32, ESP8266, and RP2040. After a crash and reboot, the backtrace is logged at startup and decoded automatically when you connect viaesphome logs. No serial cable is needed.
On ESP32, automatic crash reporting requires the ESP-IDF framework (the default). It is not available when using the Arduino framework on ESP32. On ESP8266 and RP2040, crash reporting is always available regardless of framework.
Decoded backtraces require debug symbols from the same build that is running on the device. Always compile locally before trying to capture crash data:
After the device crashes and reboots, connect immediately — crash data survives software resets but is lost on a power cycle:
[12:31:55][E][esp32.crash:221]: *** CRASH DETECTED ON PREVIOUS BOOT ***
[12:31:55][E][esp32.crash:224]: Reason: Fault - StoreProhibited
[12:31:55][E][esp32.crash:228]: PC: 0x4011AD40 (fault location)
WARNING Decoded 0x4011AD40: setup()::{lambda()#1}::_FUN() at my-device.yaml:89
[12:31:55][E][esp32.crash:242]: BT0: 0x4011AD3D (backtrace)
WARNING Decoded 0x4011AD3D: setup()::{lambda()#1}::_FUN() at my-device.yaml:89
[12:31:55][E][esp32.crash:242]: BT1: 0x4011AD95 (backtrace)
WARNING Decoded 0x4011AD95: esphome::StatelessLambdaAction<>::play()
[12:31:55][E][esp32.crash:242]: BT2: 0x4011AD77 (backtrace)
WARNING Decoded 0x4011AD77: esphome::Action<>::play_complex()
Serial Console Stack Trace
When you need the full register dump or cannot reach the device over the network, connect via USB and letesphome logs decode the crash in real time:
Alternative: Web-Based Stack Trace Decoder
If you already have an undecoded backtrace and cannot use the CLI, use the ESP Stack Trace Decoder web tool:In the ESPHome Device Builder, click the three-dot menu on your device card and select Download .elf file. This file contains the debug symbols for your last local build.
Navigate to https://esphome.github.io/esp-stacktrace-decoder/.
The
.elf file must be from the same compilation as the firmware currently running on the device. If you have recompiled since flashing, the debug symbols will not match and decoding will produce incorrect results.Adjusting Log Levels for Debugging
Increasing log verbosity is often the fastest way to understand what a component is doing (or failing to do).Global Log Level
| Level | What is logged |
|---|---|
NONE | Nothing |
ERROR | Only fatal errors |
WARN | Errors and warnings |
INFO | General informational messages |
DEBUG | Debug output (default) |
VERBOSE | Detailed per-component trace |
VERY_VERBOSE | All internal messages including I²C/SPI bus traffic |
Per-Component Log Level
Narrow logging to a specific component to reduce noise:ESP-IDF Framework Log Level
When using the ESP-IDF framework on ESP32, you can also set the framework’s internal log level independently:Common Issues
Wi-Fi not connecting / node keeps reconnecting
Wi-Fi not connecting / node keeps reconnecting
Random Wi-Fi disconnects are usually caused by signal quality, power supply issues, or access point configuration. Try these steps in order:
-
Enable fast_connect if you use a hidden SSID, or as a general improvement:
-
Assign a static IP to avoid DHCP timing issues:
-
Reduce Wi-Fi transmit power to lower current spikes (especially useful on battery or cheap USB adapters):
-
Adjust power-save mode — try
lightornone: -
Check for
reboot_timeout— ESPHome reboots if the API or MQTT connection is lost for too long. Increase or disable it for offline-first devices:
OTA update times out or fails
OTA update times out or fails
- Verify the device is reachable:
ping <hostname>.local - Check that the OTA password in your YAML matches the one compiled into the running firmware.
- Ensure you are on the same network subnet as the device — OTA uses mDNS for host resolution.
- Close all other connections to the device (log viewer, Home Assistant) before uploading; this frees heap memory, especially important on ESP8266.
- If the device is in safe mode, it will still accept OTA — push a corrected firmware image.
Out of memory / heap exhaustion on ESP8266
Out of memory / heap exhaustion on ESP8266
ESP8266 has only ~80 KB of usable RAM. Symptoms include random crashes, failed OTA uploads, and log messages like
malloc failed.Reduce memory usage:- Set the logger level to
WARNor higher in production. - Avoid large string operations in lambdas.
- Disable unused components (captive portal, web server).
- Consider migrating to an ESP32-C3, which offers ~5× the RAM at a similar price point.
Watchdog timeout / task_wdt triggered
Watchdog timeout / task_wdt triggered
A watchdog timeout means some code blocked the main loop for too long. Common causes:Then look at the
- A
delay()call in a lambda (usedelay:as a YAML action instead, which is async). - A blocking I²C or SPI operation.
- A slow
while:loop without adelayaction inside.
max column in the output to find which component takes the most time per loop iteration.Component took a long time for an operation
Component took a long time for an operation
Brownout detector was triggered
Brownout detector was triggered
The ESP32’s brownout detector fires when supply voltage drops below a safe threshold — usually during Wi-Fi transmit bursts that draw 300–500 mA.Fixes, in order of effectiveness:
-
Reduce Wi-Fi transmit power:
-
Lower the CPU frequency:
- Use a quality 5V/2A power supply with a short, thick USB cable.
- Add a 100–1000 µF electrolytic capacitor across the 3.3 V and GND pins.
Compilation errors in lambdas
Compilation errors in lambdas
ESPHome passes lambda content directly to the C++ compiler without pre-validation. Common mistakes:Or look at the full PlatformIO build output:
- Missing semicolons — every C++ statement must end with
; - Wrong type —
id(some_sensor).statereturns afloat, not anint - Missing
returnin a condition lambda — condition lambdas mustreturn true;orreturn false;
Debug Component
Thedebug: component logs detailed device information at boot — heap size, flash chip details, reset reason, and loop timing — useful for diagnosing intermittent issues: