mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #4378] [Issue]: One malformed row in any file-backed table JSON crashes server bootstrap #2374
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#2374
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Gunterlie on GitHub (Jul 31, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/4378
Originally assigned to: @SpicyMarinara on GitHub.
Summary
A single malformed entry (
null, a string, a number) inside any file-backed table JSON file crashes server bootstrap with aTypeError.parseJsonFilevalidates only that the parsed value is an array; the element shape is never checked before rows are dereferenced.Expected behavior
A corrupt individual row should be handled the way a corrupt file already is: reported, quarantined or skipped with a clear log line naming the table and file, and the rest of the table loaded normally. The user should be able to start the app and recover.
Actual behavior
normalizeRowcallsObject.prototype.hasOwnProperty.call(row, column.key)on every element unconditionally (packages/server/src/db/file-backed-store.ts:680). For anullelement that throwsTypeError: Cannot convert undefined or null to object, which propagates out of the load loop and aborts startup. The table's per-row migrations (migrateLegacyNoodleAccountRow,migrateRetiredChatModeRow) sit on the same path and would throw on the same inputs.This affects every table in
FILE_BACKED_TABLES(~60), not one specific feature.Steps to reproduce
chats.json) and insert a barenullinto the array.Environment
2.3.5/ stagingLogs, screenshots, or video
Additional context
Surfaced while reviewing #4377 (
visual_novelstartup crash). It was deliberately left out of that PR: it is pre-existing rather than introduced there, and fixing it for only the three tables that PR touches would be inconsistent and would trade a loud failure for silent data loss.Design note worth settling before implementation: dropping a bad row silently loses user data, where today the load fails loudly with the file intact on disk. The existing
quarantineUnrecoverableFilespath is probably the right model — preserve the original file, load what is valid, log loudly — but it currently operates at file granularity, not row.Related: #4375, #4377
Template check
Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked: