Skip to content
FR
  1. LuzineDebug
  2. Electronics & Arduino
  3. Guru Meditation Error: Core 1 panic'ed (LoadProh…
Electronics & Arduino Advanced ≈ 30 min to fix

Fix "Guru Meditation Error: Core 1 panic'ed (LoadProhibited)" on ESP32

Error message
Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.
  • Guru Meditation Error: Core 0 panic'ed (StoreProhibited). Exception was unhandled.
  • Guru Meditation Error: Core 0 panic'ed (Load access fault). Exception was unhandled.
  • Guru Meditation Error: Core 1 panic'ed (Interrupt wdt timeout on CPU1).
  • ***ERROR*** A stack overflow in task loopTask has been detected.
  • E (10123) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
In short

The ESP32 crashed on a CPU exception and reboots: with LoadProhibited, the program read an invalid memory address, most often through a null pointer. Decode the backtrace to get the faulty file and line, then fix the pointer, the task stack size or the out-of-bounds access.

Be the first to confirm this fix

What this error means

"Guru Meditation Error" is the message of the ESP-IDF panic handler, also used by the Arduino ESP32 core. The given core (Core 1 runs setup() and loop() in Arduino, Core 0 the Wi-Fi and Bluetooth stack) raised an exception that nothing handled. The type in parentheses says what happened: LoadProhibited or StoreProhibited for a read or write at an invalid address, InstrFetchProhibited for a jump to an invalid address, Load access fault on RISC-V chips (ESP32-C3, C6, H2). Then come the registers (PC, EXCVADDR = faulty address), the Backtrace: line and a reboot.

Common causes

  1. Null or uninitialized pointer: object never created, malloc() returned NULL, sensor whose init failed. An EXCVADDR close to 0x00000000 (for example 0x0000000c) points to accessing a struct member through a null pointer.
  2. Task stack too small: large local arrays in loop() or in a FreeRTOS task created with a tight stack. In ESP-IDF, the size passed to xTaskCreate() is in bytes, not words.
  3. Corrupted memory: writing past the end of an array, pointer to a local variable that no longer exists, String.c_str() of a temporary object, double free().
  4. Non-void function without return: in C++ this is undefined behavior, and on ESP32 it often ends in IllegalInstruction or InstrFetchProhibited.
  5. Badly written interrupt or blocking loop: ISR without IRAM_ATTR, Serial.print() or delay() inside an ISR, while loop with no pause that starves the watchdog (Task watchdog got triggered, Interrupt wdt timeout).

Step-by-step fix

  1. Read the exception type and EXCVADDR

    Copy the whole block, from "Guru Meditation Error" down to the Backtrace: line. Note the exception type, the core and EXCVADDR. If the monitor scrolls too fast because of the reboots, unplug the board right after the crash or make it halt on panic (see FAQ).

    plaintext
    Guru Meditation Error: Core  1 panic'ed (LoadProhibited). Exception was unhandled.
    PC      : 0x400d1a2b  PS      : 0x00060a30  A0      : 0x800d2c3d  A1      : 0x3ffb2270
    EXCVADDR: 0x0000000c  LBEG    : 0x4000c2e0  LEND    : 0x4000c2f6  LCOUNT  : 0xffffffff
    
    Backtrace: 0x400d1a28:0x3ffb2270 0x400d2c3a:0x3ffb2290 0x400d5e11:0x3ffb22b0
  2. Decode the backtrace

    The addresses mean nothing until they are translated into file and line. With ESP-IDF, idf.py monitor does it automatically. With PlatformIO, add the esp32_exception_decoder filter. With Arduino IDE 1.8, use the EspExceptionDecoder tool (Tools > ESP Exception Decoder); with IDE 2.x, install the community esp-exception-decoder extension or run addr2line on the .elf file in the build folder (path shown with verbose compile output).

    bash
    # ESP-IDF: decodes the backtrace live
    idf.py -p /dev/ttyUSB0 flash monitor
    
    # PlatformIO (platformio.ini)
    # monitor_filters = esp32_exception_decoder
    # build_type = debug
    
    # Manual decoding (use riscv32-esp-elf-addr2line on C3/C6/H2)
    xtensa-esp32-elf-addr2line -pfiaC -e build/firmware.elf 0x400d1a28 0x400d2c3a 0x400d5e11
  3. Check pointers before use

    At the reported line, find the dereferenced pointer. Always check the return values of malloc(), new (std::nothrow), begin() functions and lookups that may find nothing, and stop cleanly instead of carrying on with NULL.

    cpp
    uint8_t *buf = (uint8_t *)malloc(4096);
    if (buf == nullptr) {
      Serial.println("malloc failed");
      return;
    }
    
    Sensor *sensor = findSensor(id);
    if (sensor != nullptr) {
      value = sensor->read();
    }
  4. Enlarge the stack or move large arrays out

    Measure the remaining stack margin with uxTaskGetStackHighWaterMark(): a value close to 0 confirms the problem. Give the task more stack, or move large arrays to static or the heap. In Arduino, the loop() stack (8 KB by default) is set with SET_LOOP_TASK_STACK_SIZE().

    cpp
    SET_LOOP_TASK_STACK_SIZE(16 * 1024);  // Arduino core: loop() stack in bytes
    
    void worker(void *arg) {
      static uint8_t frame[8192];  // static: not on the task stack
      for (;;) {
        Serial.printf("free stack: %u\n", uxTaskGetStackHighWaterMark(NULL));
        vTaskDelay(pdMS_TO_TICKS(1000));
      }
    }
    
    void setup() {
      Serial.begin(115200);
      // stack size in bytes on ESP-IDF / Arduino ESP32
      xTaskCreatePinnedToCore(worker, "worker", 8192, NULL, 1, NULL, 1);
    }
    
    void loop() {}
  5. Write safe interrupts

    An ISR must live in IRAM, stay very short and never call Serial, delay(), malloc() or Wi-Fi. Set a volatile flag and do the work in loop() or a task.

    cpp
    volatile bool pressed = false;
    
    void IRAM_ATTR onButton() {
      pressed = true;
    }
    
    void setup() {
      Serial.begin(115200);
      pinMode(0, INPUT_PULLUP);
      attachInterrupt(digitalPinToInterrupt(0), onButton, FALLING);
    }
    
    void loop() {
      if (pressed) {
        pressed = false;
        Serial.println("button");
      }
    }
  6. Watchdog variant: yield to the system

    Task watchdog got triggered or Interrupt wdt timeout means a task hogged the CPU without ever yielding. Add a delay(1) or vTaskDelay() in long loops and replace busy-waiting with a blocking wait. Disabling the watchdog hides the hang instead of fixing it: a frozen device will no longer reboot by itself.

    cpp
    // Bad: busy loop, starves the watchdog
    // while (!dataReady) {}
    
    // Good: yield while waiting
    while (!dataReady) {
      vTaskDelay(pdMS_TO_TICKS(1));
    }

Did this fix work for you?

Confirm it in one click: it will rise for the next developers stuck on the same error.

Keep it from coming back

  • Turn on all compiler warnings (Arduino IDE: Preferences > Compiler warnings > All): they flag functions without return and many dubious pointers.
  • Set up backtrace decoding from the start of the project, so a crash immediately gives you a file and line.
  • Watch uxTaskGetStackHighWaterMark() during development and keep a margin of at least 1 KB per task.

Frequently asked questions

What does LoadProhibited mean on ESP32?

The CPU tried to read from an address that is not valid memory. If EXCVADDR is 0x00000000 or a small value, it is almost always a null pointer.

How do I stop the ESP32 from reboot-looping after the panic?

In ESP-IDF, idf.py menuconfig > Component config > ESP System Settings > Panic handler behaviour, pick "Print registers and halt" (CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT). The board stops and the message stays readable.

Why Core 1 and not Core 0?

In Arduino, setup() and loop() run on Core 1: a crash on that core usually comes from your code. On Core 0, look at Wi-Fi or Bluetooth callbacks and the tasks you pinned there.

Useful tools for this error

More Electronics & Arduino errors

All Electronics & Arduino errors →