openclaw - 💡(How to fix) Fix [Bug] Config file corrupted on crash — agent disappears after restart [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#71477Fetched 2026-04-26 05:12:24
View on GitHub
Comments
1
Participants
2
Timeline
3
Reactions
0
Author
Participants
Timeline (top)
closed ×1commented ×1cross-referenced ×1

Error Message

  • Config audit: C:\Users\Z-ANN\.qclaw\logs\config-audit.jsonl
  • Main log: C:\Users\Z-ANN\AppData\Roaming\QClaw\logs\main\2026-04-25.enc

Root Cause

Root cause: The corruption happened DURING the crash/freeze — before any user action. No config.write event precedes the invalid state. QClaw crashed → wrote corrupted config → user restarted → QClaw read invalid config and generated default minimal config.

RAW_BUFFERClick to expand / collapse

Bug Description

When the QClaw desktop app freezes/crashes and the user restarts it, the openclaw.json config file gets corrupted and reset to a default minimal state, causing all agent configurations to disappear.

Steps to Reproduce

  1. QClaw app becomes unresponsive (freeze/hang)
  2. User restarts QClaw (via UI or killing the process)
  3. After restart, openclaw.json is ~5-6KB instead of previous ~26KB
  4. All custom agents are gone from the config

Evidence

Timeline (UTC → Beijing time):

  • 2026-04-25T07:25:17 (15:25 Beijing) — config valid: false (JSON corrupted, no write event recorded)
    • Suspicious: size-drop-vs-last-good:26450->8149
    • hasMeta: false, gatewayMode: null (completely broken)
  • 2026-04-25T07:31:10 (15:31 Beijing) — config written at 5,464 bytes (~78% smaller than original 26,450)
  • All subsequent observations show ~5-6KB, never restored to original

Root cause: The corruption happened DURING the crash/freeze — before any user action. No config.write event precedes the invalid state. QClaw crashed → wrote corrupted config → user restarted → QClaw read invalid config and generated default minimal config.

Clobbered files saved but NOT used for recovery:

  • C:\Users\Z-ANN\.qclaw\openclaw.json.clobbered.2026-04-25T08-05-14-482Z (5,896 bytes)
  • restoredFromBackup: false throughout

Last known good config:

  • Hash: 91575c13b182a78b37b64e6e757ac572d82c1bcea5a51689b3b87fd558348ba9
  • Observed at: 2026-04-21T23:08:42.133Z
  • System saved this hash but did NOT automatically restore

Expected Behavior

When QClaw detects corrupted or significantly changed config (26K → 8K is 69% drop), it should:

  1. Restore from the backup copy automatically, OR
  2. Prompt the user before overwriting, OR
  3. At minimum, preserve the backup before writing default config

Environment

  • Windows 11 (x64)
  • QClaw: 2026.4.5
  • openclaw-manage: 2026.4.5
  • Config path: C:\Users\Z-ANN\.qclaw\openclaw.json

Additional Context

  • No explicit reset button was clicked — this is automatic behavior triggered by crash/restart
  • The clobbered backup mechanism exists but is not used for recovery — wasted safety mechanism
  • The user experienced this as "my agent was deleted" when in fact only the config was reset

Logs

  • Config audit: C:\Users\Z-ANN\.qclaw\logs\config-audit.jsonl
  • Main log: C:\Users\Z-ANN\AppData\Roaming\QClaw\logs\main\2026-04-25.enc

extent analysis

TL;DR

The QClaw app's automatic config reset after a crash can be mitigated by modifying the config handling logic to restore from a backup copy when corruption is detected.

Guidance

  • Review the config audit logs (C:\Users\Z-ANN\.qclaw\logs\config-audit.jsonl) to understand the sequence of events leading to the config corruption.
  • Implement a check for significant config size changes (e.g., 69% drop) and restore from the last known good backup when such a change is detected.
  • Consider adding a prompt to the user before overwriting the config with a default minimal state.
  • Investigate why the clobbered backup mechanism is not being used for recovery and modify the code to utilize this safety feature.

Example

No code snippet is provided due to the lack of specific implementation details in the issue.

Notes

The provided information suggests that the issue is related to the QClaw app's handling of config files during crashes and restarts. However, without access to the app's source code, it's challenging to provide a definitive solution.

Recommendation

Apply a workaround by modifying the config handling logic to restore from a backup copy when corruption is detected, as this approach addresses the root cause of the issue and prevents data loss.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix [Bug] Config file corrupted on crash — agent disappears after restart [1 comments, 2 participants]