Local database corruption is not recoverable / "no backend registered" errors with empty inboxes
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- playwright, sqlite, typescript
Research direction
Start with src/db/shared-worker.ts and src/db/bootstrap-idb.ts to trace how boot failures are cached, then read src/stores/auth-store.ts and src/sync/sync-client.ts for error handling and backend lookup. Check AGENTS.md for the Playwright test setup and inspect the related pull request #227. Done means a corrupted cache can recover and resync, with typed errors and coverage for that flow.
Written by the indexing model from the issue text.
Description
Describe the bug
The browser keeps a disposable SQLite cache (wa-sqlite on IndexedDB, in a SharedWorker), and the UI reads only from that cache. Corruption of the local copy therefore leaves the app unusable even though the server data is intact.
Findings from reading the code
- No corruption handling. Nothing in
src/db,src/storesorsrc/synchandlesSQLITE_CORRUPT/NOTADBor deletes and rebuildsstormbox.sqlite. The only recovery currently is for the user to clear site data by hand. - Boot failure is cached forever.
getHandlers()(src/db/shared-worker.ts) andbootProductionEngine()(src/db/bootstrap-idb.ts) keep a rejected promise. After one failed boot, every RPC from every tab fails until the worker dies, andstartSyncAccountnever registers a backend. - Raw error shown.
reportDatabaseError(src/stores/auth-store.ts) only recognisesDatabaseUnavailableError, which is created only for the Firefox startup timeout. A corruption error is shown as its raw message, with no recovery steps. - "No backend registered" message. It comes from
SyncClient.getBackend(src/sync/sync-client.ts:62) as a plainError, not the typedaccountUnavailableused elsewhere insync-host.ts. It occurs when a tab holds anaccountIdbut the worker's backend map has no entry for it, for example after a worker restart or replacement without the tab reloading. - Suspected trigger, not confirmed. The corruption may relate to the Firefox exclusive-locking and journal change (#228), or the wa-sqlite 2.0.9 upgrade (#229), acting on a database written by an earlier build. Mixed asset versions across tabs could also contribute.
Related: https://github.com/thunderbird/stormbox/pull/227
To Reproduce
- Boot failure is cached. In a profile with Webmail signed in, corrupt the
stormbox.sqliteIndexedDB data (for example, overwrite a block through DevTools) and reload.- Expected from the code: the raw "malformed" message appears, and a reload without closing all tabs does not recover.
- "No backend" message. With Stormbox signed in, cause the SharedWorker to be replaced without the tab reloading. Examples are a Firefox handoff via a second tab on a different build, or killing the worker from
about:debuggingorchrome://inspect/#workers.- Check whether the original tab shows empty inboxes and "No jmap-mail backend registered for account N".
- Affected users. Ask for browser and version, whether the database predates Oct 26, whether several tabs were open, and the console output. Look for
[worker:sync-host] startAccount completeand anyshared-workerboot or restart warnings. - Clearing site data. Check that it fixes both reports. If it does, that confirms the cache is the cause.
Expected behavior
Corrupted databases should hopefully have a path for self-heal. This is a proposed fix (not implemented):
- On
SQLITE_CORRUPT/NOTADBduring open or migrations, delete the IndexedDB database and boot once more. - Don't cache a rejected boot promise.
- Map corruption to a typed UI error with recovery instructions.
- Make
getBackendthrow the typedaccountUnavailableerror, and have the store re-runstartSyncAccounton it. - Add Playwright coverage (per AGENTS.md) for a corrupted database recovering and resyncing.
Actual behavior
Empty mailbox with a database error per screenshot below.
Screenshots
System
- OS: macOS Tahoe 26.6.2
- Browser Version: Firefox 158.0
- Dominant language
- TypeScript
- Stars
- 121
- Forks
- 11
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 11
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from thunderbird/stormbox
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
thunderbird/stormbox#260 ·
Maintainers usually reply within 1 day
-
ux
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
thunderbird/stormbox#254 ·
Maintainers usually reply within 1 day
-
mobile ux
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
thunderbird/stormbox#182 ·
Maintainers usually reply within 1 day
-
mobile ux
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
thunderbird/stormbox#179 ·
Maintainers usually reply within 1 day
-
mobile ux
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
thunderbird/stormbox#175 ·
Maintainers usually reply within 1 day
All issues in thunderbird/stormbox
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
ai-driven-qa bug claude Cosmetic
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Domain / chatbot New
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Inist-CNRS/lodex#3861 ·
Maintainers usually reply within 1 day
-
area:agent-sdk area:docs documentation enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
anthropics/claude-code#110914 ·
-
area/cli platform/windows type/bug version/v2
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
anomalyco/opencode#64631 · 1 comment ·
Maintainers usually reply within 1 day