Help with error e0

Hello everyone.
I'm having trouble pin pointing the source of an error I'm encountering.
My game runs OK for around 5 to 7 minutes and then it freezes and a couple of seconds later the Playdate shows the e0 error screen.

My first thought was a memory leak, but looking at the device info while running, the memory is steady and far from the maximum when the error happens. In the following screenshot you can see that the game was using around 60% of the memory before the crash. And after the crash the graph just goes crazy filling up the whole screen :stuck_out_tongue_winking_eye:

EDIT: I forgot to add, there are no errors in the console. :frowning:

So my question is, what are other possible causes of the e0 error apart from memory leaks? I though about a stack overflow, but I'm not using recursion.

Any ideas or tips are welcome.

Thanks in advance for your help.

In my experience e0 can be any fatal error.

Have you tried reproducing this in simulator and after you reproducing it running the Sim again with a debugger attached?

Also, in the root of of the playdate's storage there will be a crashlog.txt. This can be used to analyse the cause.

1 Like

Yeah. I can reproduce the error in simulator, but the simulator becomes unresponsive and I can't do anything after it happens.

I didn't know about the crashlog file, I'll check that out.

Thanks for the help!

The crashlog file has a bunch of these blocks:

--- crash at 2025/03/15 11:57:54---
build:57176cb0-2.6.2-release.177516-buildbot
   r0:00000000    r1:00000000     r2:00000000    r3: 00000000
  r12:00000003    lr:24050dc9     pc:24050dd2   psr: 010f002c
 cfsr:00000000  hfsr:40000000  mmfar:00000000  bfar: 00000000
rcccsr:00000000
heap allocated: 10530848
Lua totalbytes=128659907 GCdebt=-127574356 GCestimate=1050115 stacksize=84

They all have different memory allocation values, but the thing that is constant is the stacksize=84

Could that be the maximum stack size and it is crashing due to a stack overflow?

That crashlog entry indicates it's crashing within the code to update the Lock button LED, since it should flash white when the device crashes. What's probably happening here (at least, according to Dave on Discord) is that it crashed for some other reason but the LED code is crashing instead, so the crashlog isn't going to be of much help to determine the root cause.

My best guess is that you've created an infinite loop in your code:

  • The device has a watchdog timer so that if your game's update callback runs for more than 10 seconds without returning or yielding, the device will crash with an e0.
  • The simulator becomes unresponsive because it has no such watchdog.
1 Like

I found the problem!!!

It was due to a projectile that kept going infinitely out of the screen and its Y coord reached a value too high for the Playdate to handle.

I always try to avoid these kind of issues and I have code to handle the elements where they are out of the screen, but in this edge case, the projectile "avoided" my checks and kept going. It was very tricky to catch because one of the conditions for the error to happen was that the projectile was already out of the screen when spawned.

Well. I hope this post helps someone on the future. The error e0 is not only because of infinite loops, but also caused by value over/underrun.