Guru Meditation Error: the ESP32 crashes and restarts

  • ESP32

You may see

Guru Meditation Error: Core  1 panic'ed (LoadProhibited). Exception was unhandled.
Guru Meditation Error: Core 0 panic'ed
Stack canary watchpoint triggered
Backtrace: 0x

Why it happens

  • Reading outside an array.
  • Using a screen, sensor or Bluetooth object before its begin().
  • Long work inside an interrupt or a web request.

How to fix it

  1. Note the last line printed before the crash: the trouble is just after it.
  2. Check array sizes and loop limits.
  3. Make sure every begin() is in setup() and you check that it worked.
  4. Keep interrupt functions tiny: set a flag, and do the work in loop(). Mark them IRAM_ATTR.
  5. In an async web server don't use delay() inside the request function.

It worked if: It runs past the line where it used to crash.

From the official documentation. Message format from Espressif's fatal errors page. Sources: Espressif: fatal errors.

Didn't help? Search another error or ask us.