LoadProhibited means your code read from a memory address that does not exist, nearly always through a pointer that was never set. It is a software bug, not a hardware fault. The backtrace in the serial output tells you which line.
What the message means
The line reads “Guru Meditation Error: Core 1 panic’ed (LoadProhibited). Exception was unhandled.” The core tried to load from an invalid address and stopped. EXCVADDR near 0x00000000 usually means a null pointer.
Fix it in this order
- Copy the whole crash dump from the serial monitor. The “Backtrace:” line is the useful part.
- Decode it with the ESP exception decoder for your IDE, or addr2line, to get file and line numbers.
- Look for pointers, objects or arrays used before they were created: a WiFiClient, sensor object or buffer used before begin().
- Check array indexes and string lengths where the crash line points.
- Check that a function returning a pointer did not return null. Check for failed memory allocation.
- If it crashes only after Wi-Fi events, check callbacks that touch objects freed or not yet created.
Why it happens
LoadProhibited means the code tried to read from an invalid memory address, most often a null or uninitialised pointer. A common cause is using an object before its begin() or constructor has run, or a library function that was handed a missing object.
Read the backtrace in the Serial Monitor, decode it with the exception decoder or addr2line to find the line, and check every pointer and every device object on that path. Check that sensors, files and network clients really started before use.
If you see this, do this
| You see | Do this |
|---|---|
| EXCVADDR is 0x00000000 | A null pointer. Find the object that was never initialised. |
| It crashes at start-up | Something used in setup() before it is ready. |
| It crashes after hours | Look for memory leaks and unbounded String growth. |
Related
ESP32 pinout for robotics, MQTT telemetry on the ESP32.
Last reviewed: November 2026. These are the usual causes and the order that finds them fastest. Test on your own board; clones and cables differ.
Why this happens
The ESP32 CPU can only load from addresses that map to real memory or peripherals. If your code follows a pointer whose value is 0, or some other address that points nowhere, the load is refused and the panic handler prints LoadProhibited. The program has already done something wrong before the crash; the exception only shows where it was caught.
A null pointer to a structure or object makes the failing address a small number, not always zero. Reading a field that sits 4 bytes into the structure fails at address 0x00000004, so EXCVADDR (the address that caused the fault) near zero still means a null pointer. A large garbage value suggests memory that was freed or overwritten.
How to confirm the cause
- Read the line that begins with EXCVADDR. A value under about 0x1000 means a null pointer plus an offset.
- Copy the Backtrace line and decode it. In PlatformIO, add monitor_filters = esp32_exception_decoder. In Arduino IDE, use an ESP exception decoder tool, or run the toolchain’s xtensa-esp32-elf-addr2line against the compiled .elf file.
- Open the file and line the decoder gives and list every pointer or object used on that line. One of them is null or invalid.
- Add Serial.println() before the suspect line to print the pointer value. A null pointer prints as 0.
- Print ESP.getFreeHeap() just before the crash. A very low value suggests a failed allocation returned null.
Worked example
This sketch shows the pattern and its guard. A pointer starts as null, and the guard stops the code reading through it until the object exists.
struct Sensor { int value; };
Sensor *s = nullptr; // not created yet
void setup() {
Serial.begin(115200);
}
void loop() {
if (s == nullptr) { // without this check, s->value would panic
Serial.println("sensor object not created");
delay(1000);
return;
}
Serial.println(s->value);
}Without the guard, s->value reads address 0x00000000 and the board prints LoadProhibited with EXCVADDR 0x00000000. The cure is never the guard alone: find why the object was not created and fix the order of initialisation.
Common mistakes
- Treating the crash as a hardware fault and replacing the board.
- Reading only the first line of the dump and ignoring the backtrace.
- Using a library object in a global constructor before the hardware is ready, when it should be started inside setup().
- Keeping a pointer to a local variable that no longer exists after the function returns.
If this did not fix it
- Stack overflow in a task: increase the task stack size, as a deep call or big local array can corrupt memory.
- A String or buffer that grows without limit and runs the heap out.
- A callback that runs on another core and touches an object being changed in loop().