Preview build — page text is a draft awaiting human review. Code badges come from real compiles. The flasher is real but not yet hardware-tested; the Playground is still a preview.
Crash · ESP32

Fix “Guru Meditation Error: Core 1 panic'ed (IllegalInstruction)”

The ESP32 tried to run bytes that aren't valid code. Classic cause: a non-void function missing its return. Also stack corruption and bad flash settings.

ESP32ESP32-S3ESP32-CAMUpdated 3 Nov 2026

Community draft — report a mistake

What you see

OutputOutput
Guru Meditation Error: Core  1 panic'ed (IllegalInstruction). Exception was unhandled.
Memory dump at 0x400d2c3c: 7ffffd36 f01d0000 00004136
Core  1 register dump:
PC      : 0x400d2c43  PS      : 0x00060230  A0      : 0x800d2d60  A1      : 0x3ffb21d0
...
Backtrace: 0x400d2c40:0x3ffb21d0 0x400d2d5d:0x3ffb21f0 0x400d8a1d:0x3ffb2210 0x4008a2f6:0x3ffb2230

ELF file SHA256: 9e3f2c0a6b1d48e7

Rebooting...

“IllegalInstruction” means the processor fetched something to execute that isn’t a valid Xtensa instruction. The chip isn’t broken; the program counter has landed somewhere it never should.

On the ESP32 the most common trigger is surprisingly simple: a function declared to return a value that has a path with no return. Turn on all compiler warnings and the compiler points straight at it.

Quick fix — try in order

  1. 1

    Look for a function that doesn't return a value

    int readLevel() { if (ok) return x; } — when ok is false, nothing is returned and GCC's optimiser can jump into garbage. Turn on File → Preferences → Compiler warnings → All and fix every “no return statement in function returning non-void”.

  2. 2

    Decode the backtrace

    The first address in your own code shows which function crashed. Use the ESP Exception Decoder or addr2line with the sketch's .elf file.

  3. 3

    Check for array overruns and big local arrays

    Writing past the end of a local array overwrites the return address on the stack, so the CPU “returns” into data. Bounds-check indexes; move large buffers out of functions (make them static or global).

  4. 4

    Rule out flash settings

    If the crash address changes every boot even with a simple sketch, re-upload with Flash Mode DIO and 40 MHz and erase all flash first.

Why it happens

Why does a missing return crash only on ESP32?

On AVR it usually “works” by luck. The ESP32 compiler treats falling off the end of a non-void function as undefined behaviour and may drop the return instruction entirely, so execution runs straight into whatever bytes follow.

Callbacks with the wrong signature

A callback declared to return bool but written as void (or the other way round) does the same thing. Match the library's exact prototype.

Memory dump line

“Memory dump at 0x…” shows the bytes the CPU tried to execute. Bytes that are clearly not instructions confirm a jump into data rather than a hardware fault.

Board-specific notes

ESP32-C3 / C6 (RISC-V): These chips print “Illegal instruction” with MEPC instead of PC. Same causes; see the RISC-V crash page for decoding.

↑↓ to move · Enter to open