openclaw - 💡(How to fix) Fix Bug: tasks registry restore fails on malformed SQLite image [1 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#71689Fetched 2026-04-26 05:09:46
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Participants

Gateway startup repeatedly failed to restore durable task registry due to SQLite corruption in tasks/runs.sqlite (database disk image is malformed). This undermines durable task/closure reliability.

Error Message

{"subsystem":"tasks/registry"} ... "Failed to restore task registry" error: ERR_SQLITE_ERROR / database disk image is malformed

Root Cause

Gateway startup repeatedly failed to restore durable task registry due to SQLite corruption in tasks/runs.sqlite (database disk image is malformed). This undermines durable task/closure reliability.

Code Example

{"subsystem":"tasks/registry"} ... "Failed to restore task registry"
error: ERR_SQLITE_ERROR / database disk image is malformed
RAW_BUFFERClick to expand / collapse

Reporting Agent: GitHub Copilot Session ID: platform-infra-2026-04-25 Component: tasks/registry Severity: High

Description

Gateway startup repeatedly failed to restore durable task registry due to SQLite corruption in tasks/runs.sqlite (database disk image is malformed). This undermines durable task/closure reliability.

Reproducible Steps

  1. Start or restart gateway with a corrupted tasks/runs.sqlite.
  2. Observe startup warning from tasks/registry.
  3. Run sqlite3 tasks/runs.sqlite 'PRAGMA integrity_check;' and inspect integrity failures.

Expected Behaviour

Task registry restores cleanly; no malformed-image warnings.

Actual Behaviour

Restore fails with ERR_SQLITE_ERROR and database disk image is malformed.

Environment

  • OS: Linux (xps15-9520)
  • OpenClaw version: 2026.4.23 (a979721)
  • Branch/channel: main

Logs / Stack Trace

<details> <summary>Click to expand</summary>
{"subsystem":"tasks/registry"} ... "Failed to restore task registry"
error: ERR_SQLITE_ERROR / database disk image is malformed

PRAGMA integrity_check also reported malformed btree pages and index inconsistencies.

</details>

Suggested Fix (optional)

Add automated fallback recovery path for task registry corruption:

  • detect corruption on restore,
  • snapshot bad DB,
  • rebuild via sqlite .recover (or equivalent internal path),
  • re-open recovered DB,
  • emit explicit operator event.

extent analysis

TL;DR

The most likely fix is to implement an automated fallback recovery path for task registry corruption, utilizing SQLite's recovery capabilities.

Guidance

  • Detect corruption on restore by running PRAGMA integrity_check and checking for errors.
  • Snapshot the corrupted database to prevent data loss and facilitate debugging.
  • Rebuild the database using sqlite3's .recover command or an equivalent internal recovery mechanism.
  • Re-open the recovered database and emit an explicit operator event to notify of the recovery.

Example

sqlite3 tasks/runs.sqlite 'PRAGMA integrity_check;'

This command can be used to inspect the database for integrity failures, which can help identify corruption.

Notes

The provided Suggested Fix section implies that the development team has already considered a potential solution, which involves detecting corruption, snapshotting the bad database, rebuilding it, and re-opening the recovered database. However, the exact implementation details are not provided.

Recommendation

Apply workaround: Implement the suggested automated fallback recovery path for task registry corruption, as it addresses the root cause of the issue and provides a clear recovery mechanism.

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