[GH-ISSUE #2553] [Issue]: corrupt jsons can prevent start #1265

Closed
opened 2026-10-21 05:30:12 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @mirh on GitHub (Jun 14, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2553

Originally assigned to: @SpicyMarinara on GitHub.

Summary

Basically I got a BSOD and manifest.json, manifest.json.bak, app_settings.json, chats.json and chats.json.bak got corrupted.
It's nice that you have a recovery feature, but apparently it's not strong enough.

Expected behavior

At least after re-launching the program it starts.

Actual behavior

I had to manually delete packages\server\data\storage\ to fix the problem.

Steps to reproduce

  1. get yourself up something to cause a PAGE_FAULT_IN_NONPAGED_AREA error
  2. ???
  3. profit

Environment

  • Marinara Engine version: v1.6.1
  • Install type: installer
  • OS + version: W10

Logs, screenshots, or video

{"level":50,"time":1781402283730,"pid":18636,"hostname":"LAPTOP","err":{"type":"SyntaxError","message":"Unexpected token '\u0000', \"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\"... is not valid JSON","stack":"SyntaxError: Unexpected token '\u0000', \"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\"... is not valid JSON\n    at JSON.parse (<anonymous>)\n    at parseJsonFile (file:///K:/AI/Marinara-Engine/packages/server/dist/db/file-backed-store.js:265:30)\n    at FileTableStore.loadFileSnapshots (file:///K:/AI/Marinara-Engine/packages/server/dist/db/file-backed-store.js:861:28)\n    at FileTableStore.initialize (file:///K:/AI/Marinara-Engine/packages/server/dist/db/file-backed-store.js:649:18)\n    at createFileNativeDB (file:///K:/AI/Marinara-Engine/packages/server/dist/db/file-backed-store.js:1145:17)\n    at createWithFileStorage (file:///K:/AI/Marinara-Engine/packages/server/dist/db/connection.js:40:22)\n    at getDB (file:///K:/AI/Marinara-Engine/packages/server/dist/db/connection.js:52:25)\n    at buildApp (file:///K:/AI/Marinara-Engine/packages/server/dist/app.js:62:22)\n    at process.processTicksAndRejections (node:internal/process/task_queues:104:5)\n    at async main (file:///K:/AI/Marinara-Engine/packages/server/dist/index.js:27:17)"},"msg":"[file-storage] K:\\AI\\Marinara-Engine\\packages\\server\\data\\storage\\manifest.json is corrupt; recovering from K:\\AI\\Marinara-Engine\\packages\\server\\data\\storage\\manifest.json.bak (backup is 1s older). Edits made since the backup are unrecoverable."}
{"level":50,"time":1781402283731,"pid":18636,"hostname":"LAPTOP","err":{"type":"SyntaxError","message":"Unexpected token '\u0000', \"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\"... is not valid JSON","stack":"SyntaxError: Unexpected token '\u0000', \"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\"... is not valid JSON\n    at JSON.parse (<anonymous>)\n    at parseJsonFile (file:///K:/AI/Marinara-Engine/packages/server/dist/db/file-backed-store.js:273:29)\n    at FileTableStore.loadFileSnapshots (file:///K:/AI/Marinara-Engine/packages/server/dist/db/file-backed-store.js:861:28)\n    at FileTableStore.initialize (file:///K:/AI/Marinara-Engine/packages/server/dist/db/file-backed-store.js:649:18)\n    at createFileNativeDB (file:///K:/AI/Marinara-Engine/packages/server/dist/db/file-backed-store.js:1145:17)\n    at createWithFileStorage (file:///K:/AI/Marinara-Engine/packages/server/dist/db/connection.js:40:22)\n    at getDB (file:///K:/AI/Marinara-Engine/packages/server/dist/db/connection.js:52:25)\n    at buildApp (file:///K:/AI/Marinara-Engine/packages/server/dist/app.js:62:22)\n    at process.processTicksAndRejections (node:internal/process/task_queues:104:5)\n    at async main (file:///K:/AI/Marinara-Engine/packages/server/dist/index.js:27:17)"},"msg":"[file-storage] Manifest unparseable from primary and backup; continuing with empty manifest. A fresh one will be written on next save. (path=K:\\AI\\Marinara-Engine\\packages\\server\\data\\storage\\manifest.json)"}
{"level":50,"time":1781402283731,"pid":18636,"hostname":"LAPTOP","err":{"type":"SyntaxError","message":"Unexpected token '\u0000', \"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\"... is not valid JSON","stack":"SyntaxError: Unexpected token '\u0000', \"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\"... is not valid JSON\n    at JSON.parse (<anonymous>)\n    at parseJsonFile (file:///K:/AI/Marinara-Engine/packages/server/dist/db/file-backed-store.js:265:30)\n    at FileTableStore.loadFileSnapshots (file:///K:/AI/Marinara-Engine/packages/server/dist/db/file-backed-store.js:884:58)\n    at FileTableStore.initialize (file:///K:/AI/Marinara-Engine/packages/server/dist/db/file-backed-store.js:649:18)\n    at createFileNativeDB (file:///K:/AI/Marinara-Engine/packages/server/dist/db/file-backed-store.js:1145:17)\n    at createWithFileStorage (file:///K:/AI/Marinara-Engine/packages/server/dist/db/connection.js:40:22)\n    at getDB (file:///K:/AI/Marinara-Engine/packages/server/dist/db/connection.js:52:25)\n    at buildApp (file:///K:/AI/Marinara-Engine/packages/server/dist/app.js:62:22)\n    at process.processTicksAndRejections (node:internal/process/task_queues:104:5)\n    at async main (file:///K:/AI/Marinara-Engine/packages/server/dist/index.js:27:17)"},"msg":"[file-storage] K:\\AI\\Marinara-Engine\\packages\\server\\data\\storage\\tables\\chats.json is corrupt; recovering from K:\\AI\\Marinara-Engine\\packages\\server\\data\\storage\\tables\\chats.json.bak (backup is 1m older). Edits made since the backup are unrecoverable."}
{"level":50,"time":1781402283732,"pid":18636,"hostname":"LAPTOP","err":{"type":"SyntaxError","message":"Unexpected token '\u0000', \"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\"... is not valid JSON","stack":"SyntaxError: Unexpected token '\u0000', \"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\"... is not valid JSON\n    at JSON.parse (<anonymous>)\n    at parseJsonFile (file:///K:/AI/Marinara-Engine/packages/server/dist/db/file-backed-store.js:273:29)\n    at FileTableStore.loadFileSnapshots (file:///K:/AI/Marinara-Engine/packages/server/dist/db/file-backed-store.js:884:58)\n    at FileTableStore.initialize (file:///K:/AI/Marinara-Engine/packages/server/dist/db/file-backed-store.js:649:18)\n    at createFileNativeDB (file:///K:/AI/Marinara-Engine/packages/server/dist/db/file-backed-store.js:1145:17)\n    at createWithFileStorage (file:///K:/AI/Marinara-Engine/packages/server/dist/db/connection.js:40:22)\n    at getDB (file:///K:/AI/Marinara-Engine/packages/server/dist/db/connection.js:52:25)\n    at buildApp (file:///K:/AI/Marinara-Engine/packages/server/dist/app.js:62:22)\n    at process.processTicksAndRejections (node:internal/process/task_queues:104:5)\n    at async main (file:///K:/AI/Marinara-Engine/packages/server/dist/index.js:27:17)"},"msg":"[startup] Unhandled error during server bootstrap"}

Additional context

The files were all 1KB or 2KB long strings of 00 (NULL).

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • [] I DID NOT read this template and provide the requested details.
Originally created by @mirh on GitHub (Jun 14, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2553 Originally assigned to: @SpicyMarinara on GitHub. ## Summary Basically I got a BSOD and `manifest.json`, `manifest.json.bak`, `app_settings.json`, `chats.json` and `chats.json.bak` got corrupted. It's nice that you have a recovery feature, but apparently it's not strong enough. ## Expected behavior At least after re-launching the program it starts. ## Actual behavior I had to manually delete `packages\server\data\storage\` to fix the problem. ## Steps to reproduce 1. get yourself up something to cause a `PAGE_FAULT_IN_NONPAGED_AREA` error 2. ??? 3. profit ## Environment - Marinara Engine version: v1.6.1 - Install type: installer - OS + version: W10 ## Logs, screenshots, or video ``` {"level":50,"time":1781402283730,"pid":18636,"hostname":"LAPTOP","err":{"type":"SyntaxError","message":"Unexpected token '\u0000', \"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\"... is not valid JSON","stack":"SyntaxError: Unexpected token '\u0000', \"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\"... is not valid JSON\n at JSON.parse (<anonymous>)\n at parseJsonFile (file:///K:/AI/Marinara-Engine/packages/server/dist/db/file-backed-store.js:265:30)\n at FileTableStore.loadFileSnapshots (file:///K:/AI/Marinara-Engine/packages/server/dist/db/file-backed-store.js:861:28)\n at FileTableStore.initialize (file:///K:/AI/Marinara-Engine/packages/server/dist/db/file-backed-store.js:649:18)\n at createFileNativeDB (file:///K:/AI/Marinara-Engine/packages/server/dist/db/file-backed-store.js:1145:17)\n at createWithFileStorage (file:///K:/AI/Marinara-Engine/packages/server/dist/db/connection.js:40:22)\n at getDB (file:///K:/AI/Marinara-Engine/packages/server/dist/db/connection.js:52:25)\n at buildApp (file:///K:/AI/Marinara-Engine/packages/server/dist/app.js:62:22)\n at process.processTicksAndRejections (node:internal/process/task_queues:104:5)\n at async main (file:///K:/AI/Marinara-Engine/packages/server/dist/index.js:27:17)"},"msg":"[file-storage] K:\\AI\\Marinara-Engine\\packages\\server\\data\\storage\\manifest.json is corrupt; recovering from K:\\AI\\Marinara-Engine\\packages\\server\\data\\storage\\manifest.json.bak (backup is 1s older). Edits made since the backup are unrecoverable."} {"level":50,"time":1781402283731,"pid":18636,"hostname":"LAPTOP","err":{"type":"SyntaxError","message":"Unexpected token '\u0000', \"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\"... is not valid JSON","stack":"SyntaxError: Unexpected token '\u0000', \"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\"... is not valid JSON\n at JSON.parse (<anonymous>)\n at parseJsonFile (file:///K:/AI/Marinara-Engine/packages/server/dist/db/file-backed-store.js:273:29)\n at FileTableStore.loadFileSnapshots (file:///K:/AI/Marinara-Engine/packages/server/dist/db/file-backed-store.js:861:28)\n at FileTableStore.initialize (file:///K:/AI/Marinara-Engine/packages/server/dist/db/file-backed-store.js:649:18)\n at createFileNativeDB (file:///K:/AI/Marinara-Engine/packages/server/dist/db/file-backed-store.js:1145:17)\n at createWithFileStorage (file:///K:/AI/Marinara-Engine/packages/server/dist/db/connection.js:40:22)\n at getDB (file:///K:/AI/Marinara-Engine/packages/server/dist/db/connection.js:52:25)\n at buildApp (file:///K:/AI/Marinara-Engine/packages/server/dist/app.js:62:22)\n at process.processTicksAndRejections (node:internal/process/task_queues:104:5)\n at async main (file:///K:/AI/Marinara-Engine/packages/server/dist/index.js:27:17)"},"msg":"[file-storage] Manifest unparseable from primary and backup; continuing with empty manifest. A fresh one will be written on next save. (path=K:\\AI\\Marinara-Engine\\packages\\server\\data\\storage\\manifest.json)"} {"level":50,"time":1781402283731,"pid":18636,"hostname":"LAPTOP","err":{"type":"SyntaxError","message":"Unexpected token '\u0000', \"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\"... is not valid JSON","stack":"SyntaxError: Unexpected token '\u0000', \"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\"... is not valid JSON\n at JSON.parse (<anonymous>)\n at parseJsonFile (file:///K:/AI/Marinara-Engine/packages/server/dist/db/file-backed-store.js:265:30)\n at FileTableStore.loadFileSnapshots (file:///K:/AI/Marinara-Engine/packages/server/dist/db/file-backed-store.js:884:58)\n at FileTableStore.initialize (file:///K:/AI/Marinara-Engine/packages/server/dist/db/file-backed-store.js:649:18)\n at createFileNativeDB (file:///K:/AI/Marinara-Engine/packages/server/dist/db/file-backed-store.js:1145:17)\n at createWithFileStorage (file:///K:/AI/Marinara-Engine/packages/server/dist/db/connection.js:40:22)\n at getDB (file:///K:/AI/Marinara-Engine/packages/server/dist/db/connection.js:52:25)\n at buildApp (file:///K:/AI/Marinara-Engine/packages/server/dist/app.js:62:22)\n at process.processTicksAndRejections (node:internal/process/task_queues:104:5)\n at async main (file:///K:/AI/Marinara-Engine/packages/server/dist/index.js:27:17)"},"msg":"[file-storage] K:\\AI\\Marinara-Engine\\packages\\server\\data\\storage\\tables\\chats.json is corrupt; recovering from K:\\AI\\Marinara-Engine\\packages\\server\\data\\storage\\tables\\chats.json.bak (backup is 1m older). Edits made since the backup are unrecoverable."} {"level":50,"time":1781402283732,"pid":18636,"hostname":"LAPTOP","err":{"type":"SyntaxError","message":"Unexpected token '\u0000', \"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\"... is not valid JSON","stack":"SyntaxError: Unexpected token '\u0000', \"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\"... is not valid JSON\n at JSON.parse (<anonymous>)\n at parseJsonFile (file:///K:/AI/Marinara-Engine/packages/server/dist/db/file-backed-store.js:273:29)\n at FileTableStore.loadFileSnapshots (file:///K:/AI/Marinara-Engine/packages/server/dist/db/file-backed-store.js:884:58)\n at FileTableStore.initialize (file:///K:/AI/Marinara-Engine/packages/server/dist/db/file-backed-store.js:649:18)\n at createFileNativeDB (file:///K:/AI/Marinara-Engine/packages/server/dist/db/file-backed-store.js:1145:17)\n at createWithFileStorage (file:///K:/AI/Marinara-Engine/packages/server/dist/db/connection.js:40:22)\n at getDB (file:///K:/AI/Marinara-Engine/packages/server/dist/db/connection.js:52:25)\n at buildApp (file:///K:/AI/Marinara-Engine/packages/server/dist/app.js:62:22)\n at process.processTicksAndRejections (node:internal/process/task_queues:104:5)\n at async main (file:///K:/AI/Marinara-Engine/packages/server/dist/index.js:27:17)"},"msg":"[startup] Unhandled error during server bootstrap"} ``` ## Additional context The files were all 1KB or 2KB long strings of 00 (NULL). ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 05:30:12 +07:00
  • closed this issue
  • added the
    in-pr
    bug
    labels
Author
Owner

@SpicyMarinara commented on GitHub (Jun 14, 2026):

Codex is taking this in branch . I’ll harden corrupt JSON recovery so startup can continue even when primary and backup files are both damaged.

<!-- gh-comment-id:4701410529 --> @SpicyMarinara commented on GitHub (Jun 14, 2026): Codex is taking this in branch . I’ll harden corrupt JSON recovery so startup can continue even when primary and backup files are both damaged.
Author
Owner

@SpicyMarinara commented on GitHub (Jun 14, 2026):

Fix is in draft PR #2558: https://github.com/Pasta-Devs/Marinara-Engine/pull/2558

The patch keeps startup alive when both a JSON file and its .bak are corrupt/NUL-filled, logs that fallback data is being used, and marks the files for self-heal on the next flush without copying the corrupt primary over the backup.

<!-- gh-comment-id:4701431192 --> @SpicyMarinara commented on GitHub (Jun 14, 2026): Fix is in draft PR #2558: https://github.com/Pasta-Devs/Marinara-Engine/pull/2558 The patch keeps startup alive when both a JSON file and its .bak are corrupt/NUL-filled, logs that fallback data is being used, and marks the files for self-heal on the next flush without copying the corrupt primary over the backup.
Sign in to join this conversation.
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
Pasta-Devs/Marinara-Engine#1265
No description provided.