Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

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

说明与用途

Relaymote 的 registry.json 由于未清理的关闭而损坏。守护进程将损坏的文件隔离,salvage 命令恢复所有完整任务,保留 ID 和依赖关系。

问题

A registry.json file used by Relaymote was corrupted by an unclean shutdown, ending with NUL bytes that caused JSON.parse to fail.

结果

The daemon now survives corrupted registry files by quarantining them and can recover all valid tasks via a salvage command, preserving ID continuity and dependencies.

工作流

  • 1. On load, attempt to parse registry.json.
  • 2. If parsing fails, rename the file to registry.json.corrupt-<timestamp> and log a message with a recovery command.
  • 3. Scan the raw text for task IDs and seq to set the next ID counter above any existing IDs.
  • 4. Start the daemon with an empty registry but a safe ID counter.
  • 5. Run relaymote salvage to attempt recovery: trim padding, close after last complete record, or scan for individual records.
  • 6. Merge recovered tasks into the live registry, renumbering conflicts, updating dependencies, and tagging restored tasks.
  • 7. By default perform a dry run; with --apply write the merged registry using temp‑file, fsync, rename.
  • 8. The corrupted file remains untouched for repeat attempts.

证据

The writes were already done the textbook way: write a temp file, fsync it, rename it over the real one.

来源

If parsing fails, rename the file to registry.json.corrupt-<timestamp> and log a message with a recovery command.

来源

The file is written with JSON.stringify(state, null, 2), so every task object ends with a newline and exactly four spaces before its }.

来源

  • 记录日期: 2026-11-01T11:58:51.190Z