Skip to content

docs(faq): how to recover a malformed SQLite database - #210

Open
TimeToBuildBob wants to merge 2 commits into
ActivityWatch:masterfrom
TimeToBuildBob:docs/db-recovery-faq
Open

TimeToBuildBob wants to merge 2 commits into
ActivityWatch:masterfrom
TimeToBuildBob:docs/db-recovery-faq

Conversation

@TimeToBuildBob

Copy link
Copy Markdown
Contributor

Adds a FAQ entry for "database disk image is malformed": quit ActivityWatch, back up sqlite.db with its -wal/-shm files, rebuild with sqlite3 .recover (falling back to .dump), restore PRAGMA user_version, and swap the file in.

The user_version step matters. .dump does not carry it, so aw-server-rust releases before ActivityWatch/aw-server-rust#776 re-ran every migration on the restored file and crashed with a duplicate-column error. #776 (merged today) infers the version, but it is not in a release yet.

Two caveats are written in because I hit them while checking the steps. Some sqlite3 builds (Ubuntu's 3.45.1 here) have no .recover and fail with no such table: sqlite_dbpage while still creating an empty restored.db. And whether .recover keeps user_version depends on the build, so the page says to check for 0 instead of claiming either way.

Maintainers asked for this to be documented in ActivityWatch/aw-server#89.

Verified: sphinx-build produces no warnings in faq.rst (the existing changelog duplicate-label warnings are unchanged).

@TimeToBuildBob

Copy link
Copy Markdown
Contributor Author

The failed run used stale APT metadata: libpng-dev and libpng-tools 1.6.43-5ubuntu0.6 returned HTTP 404 before the docs build started. Commit b1e47b6 already adds sudo apt-get update before installation, so this dispatch refers to the superseded head d3f800c.

The replacement Build run is queued on b1e47b6; no duplicate patch or rerun is needed. The latest three master builds passed. CI success on the new head is still unverified.

@TimeToBuildBob

Copy link
Copy Markdown
Contributor Author

@greptileai review

Git-Session-Id: a51c23a1-c0bb-4da7-865c-9d9ec3107471
@TimeToBuildBob

Copy link
Copy Markdown
Contributor Author

Merge-ready. FAQ entry for recovering a "database disk image is malformed" SQLite database (.recover, falling back to .dump, and restoring user_version). Rebased on master today, dropping the duplicate apt-get workflow commit (#211 already landed).
Evidence: the data-directory anchor exists, and aw-server-rust#776 (the version-inference fix it references) is merged.
Risk: docs only.

@ErikBjare

Copy link
Copy Markdown
Member

@TimeToBuildBob review

@TimeToBuildBob

TimeToBuildBob commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 AI code review

Adds a new FAQ section to src/faq.rst explaining how to recover from a 'database disk image is malformed' error. The steps instruct the user to quit ActivityWatch, back up the SQLite files, checkpoint the WAL, salvage the database with the sqlite3 .recover command (falling back to .dump), verify and restore the PRAGMA user_version, and finally swap in the recovered database.

Safe to merge — no P0/P1 findings

Confidence 5/5

✅ No findings. The diff looks correct to me on this pass.

Files changed (1) — the diff as I read it
  • src/faq.rst — Adds a new FAQ subsection titled 'The server fails to start: "database disk image is malformed"' with step-by-step recovery instructions.
Previous review passes
commit score findings engine when
6e14de60ca4e 3/5 1 llm 2026-11-24 10:30 UTC

Reviewed 79cdae0975a8 · openrouter/deepseek/deepseek-v4-flash-0731 · llm engine · 34s · about this reviewer

Maintainer commands

@TimeToBuildBob review (own line) — fresh review · @TimeToBuildBob fix — a worker acts on the findings. Once per comment; 👀 = received.

Comment thread src/faq.rst Resolved
…t dropped

Git-Session-Id: 2e1756a6-47e6-480b-9da0-363aac57d2ba
@TimeToBuildBob

Copy link
Copy Markdown
Contributor Author

CI-green and mergeable — waiting only on a maintainer click.

This PR is ready to merge, but the bot has pull-only access to this repo and can't self-merge — surfacing it here so it isn't lost. The monitoring loop will stop re-flagging it now that this note is posted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants