A cabinet with no torrent history yet is not a failed refresh #1

Merged
charles merged 1 commit from missing-history-is-not-a-crash into main 2026-08-30 16:42:04 +00:00
Owner

Every refresh on a new cabinet failed with ENOENT on mame_torrent_history.json.

The read sat outside the try meant to guard it, so the "could not parse" message was unreachable for the commonest case (a cabinet that has never scraped) and the exception took the whole POST /api/refresh with it.

Worse on NixOS: root is the store, so the file is looked for in a read-only directory and could never be created there.

Read is inside the try now; missing is reported as "nothing scraped yet", which is what it is.

183 tests pass.

🤖 Generated with Claude Code

Every refresh on a new cabinet failed with ENOENT on `mame_torrent_history.json`. The read sat **outside** the try meant to guard it, so the "could not parse" message was unreachable for the commonest case (a cabinet that has never scraped) and the exception took the whole `POST /api/refresh` with it. Worse on NixOS: `root` is the store, so the file is looked for in a read-only directory and could never be created there. Read is inside the try now; missing is reported as "nothing scraped yet", which is what it is. 183 tests pass. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Every refresh on a newly installed cabinet failed, and the log said ENOENT on
mame_torrent_history.json inside the application directory.

The read sat outside the try that was meant to guard it. So the careful
"could not parse" message below was unreachable for the commonest case there
is -- a cabinet that has never scraped has no history -- and the exception
took the whole POST /api/refresh with it.

Worse on NixOS, where root is the store: the file is looked for in a
read-only directory, so first run could never find it and nothing could ever
create it there. Found on a real cabinet, where refresh failed twice a second
apart with no explanation a person could act on.

The read is inside the try now, and a missing file is reported as what it is
-- nothing scraped yet -- rather than as an error, because it is not one.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Nz3es8PajUzXmqJJiK6yRB
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/mame-sync!1
No description provided.