Device bricked with "Couldn't open file at games.Purchased.tmp"

My Playdate device is stuck in a continual loop. It displays this error:

games.lua:452: Couldn't open file at
stack traceback:
 [C]: in field 'write'
 games.lua:452: in upvalue 'saveOrderedGameList'
 games.lua:603: in upvalue 'loadGamesInFolder'
 games.lua:649: in local 'loadSection'
 games.lua:668: in field 'loadGames'
 menu.lua:31: in method 'setup'
 main.lua:27: in function <main.lua:25>

Pressing the A button or holding the lock+menu button for 3 seconds results in the Playdate logo briefly being displayed before displaying the error message again (presumably because the error was re-thrown).

So far I haven’t found a way to recover from this state, which prevents me from developing Playdate games on device.

Steps that may have resulted in this bad state:

  • I upgraded to the latest device version today
  • I worked through the Playdate setup wizard
  • While connected to my Macbook, I uploaded a game to my Playdate device
  • When the upload was finished, the Playdate setup wizard briefly triggered once again, before being seemingly interrupted by the game launching
  • The game crashed with the message “Couldn’t open file at levels.tmp” (the game tries to playdate.datastore.write(someData, “levels”, true) on startup)
  • I exited the game and worked my way through the Playdate setup wizard a second time
  • Upon finishing the wizard, I got stuck in a “Couldn’t open file at games.Purchased.tmp” loop

uh oh. Not being able to write levels.tmp makes me suspect disk corruption. :frowning: Can you try resetting the device into disk mode (hold menu+lock+left on the D pad for 5 seconds) then check if /Data/com.panic.Launcher exists on the disk. Is there anything in it? Go ahead and delete that folder, reboot (unmount the disk or hit A), and see if that helps at all. If not, the next thing to try is rename the Data folder to get it out of the way and create a new Data folder in its place. Move the global.settings file from the old one to the new one so you don’t have to go through setup again.

If neither of those helps, we’ll have to reformat the disk. :sob: We’re going to change to a new journaling filesystem driver soon that should keep things like this from happening in the future.

I was able to reset the device and delete the com.panic.Launcher folder in my Playdate/PlaydateSDK/Disk/Data directory. This allowed me to redo setup, but midway through it was interrupted by this error:

4-ManualTimeOffsetView.lua:71: attempt to index a nil value (local 'file')
stack traceback:
 4-ManualTimeOffsetView.lua:71 in upvalue
 4-ManualTimeOffsetView.lua:109: in method
 main.lua:657: in function <main.lua:597>

I tried resetting the device and renaming/removing the Data folder entirely, but the same thing happened again. I haven’t found way to successfully get through setup.

Gah, sorry this is taking so long. Have we ever had you connect directly to the serial port on the device using a terminal app? It looks like the disk is truly hosed and I can’t think of any other way to reformat the drive. If running a serial command by hand is practical, just connect and do formatdata, then datadisk to put it in disk mode, and copy over System from the Disk folder in the SDK. (If you want to avoid doing the setup again, first copy /Data/global.settings off the device then put it back on after the reformat.)

If dealing with the serial port is too much, I’ll put together a simulator build that can send the command.

Again, sorry to leave you hanging on this. :frowning: