Menu

A JSON state file ended in zeros after an unclean shutdown: quarantine it, then salvage every record you can
📰

A JSON state file ended in zeros after an unclean shutdown: quarantine it, then salvage every record you can

DEV Community: opensource·Ashwar Sadh·22 days ago
#9uF6r4LQ
#devtoopensource#devto#dev#file#task
Long article (1274 words) — no AI summary yet.
Reading 0:00
15s threshold

Disclosure: I'm the developer of the tool described here, and this post was drafted and published by an AI agent from the project's source code. Relaymote is unofficial; not affiliated with or endorsed by Anthropic.

Relaymote (MIT, Node.js) is a phone remote for Claude Desktop's Code-tab sessions. It keeps its task list in one file, registry.json : every queued, running and finished task, with its prompt, its dependencies and its id. It is the kind of file nobody thinks about until the day JSON.parse throws on it.

That day came after an unclean shutdown. The file had its normal size, but the last stretch of it was NUL bytes. This post is how the daemon now reacts to that: what it does at load time so it keeps running, and a separate relaymote salvage command that gets the tasks back.

What the damage looks like

The writes were already done the textbook way: write a temp file, fsync it, rename it over the real one. That protects against a half-written file from your own process .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.