Unable to sync any email accounts - database disk image malformed error


Unable to sync any mail account in Mailspring


This occurs with all email accounts. e.g., Gmail, iCloud, etc.

Email Provider

Gmail, iCloud, IMAP


  • OS and Version: Windows 11 Version 21H2 Build 22000.168
    • Installation Method: Windows Installer
  • Mailspring Version: v1.9.2-6e14dad1


26404 [2021-09-07 13:00:05.287] [main] [info] Identity created at 1625351717 - using ID Schema 1
26404 [2021-09-07 13:00:05.287] [main] [info] ------------- Starting Sync (email redacted) ---------------
26404 [2021-09-07 13:00:05.290] [metadata] [info] Metadata delta stream starting…
26404 [2021-09-07 13:00:05.840] [main] [info] [local-d0ba6443-6896] Running ChangeUnreadTask performLocal:
26404 [2021-09-07 13:00:05.842] [main] [info] [local-d0ba6443-6896] – Succeeded. Changing status to remote
26404 [2021-09-07 13:00:07.291] [background] [info] Marking all folders as busy
26404 [2021-09-07 13:00:07.292] [background] [info] Syncing folder list…
26404 [2021-09-07 13:00:08.170] [background] [info] Syncing folder list…
26404 [2021-09-07 13:00:08.287] [background] [info] syncFolderChangesViaCondstore - INBOX: modseq 468670521074495 to 468698291059391, uidnext 317711 to 317817
26404 [2021-09-07 13:00:08.478] [background] [info] syncFolderChangesViaCondstore - Changes since HMODSEQ 468670521074495: 97 changed, 9 vanished
26404 [2021-09-07 13:00:08.484] [background] [warning] Ignoring changes to Just in! Justin Lin’s All-New [F9] Director’s Cut, local data is newer 1631037608 < 1631123921
26404 [2021-09-07 13:00:08.485] [background] [warning] Ignoring changes to Shhhh, local data is newer 1631037608 < 1631124005
26404 [2021-09-07 13:00:08.485] [background] [warning] Ignoring changes to Up to $25 off :pizza: :burrito: :green_salad: :hamburger:, local data is newer 1631037608 < 1631124002
26404 [2021-09-07 13:00:08.485] [background] [info] - Building queries for range 317731-317738
26404 [2021-09-07 13:00:08.485] [background] [info] - Building queries for range 317801-317801
26404 [2021-09-07 13:00:08.485] [background] [info] Unlinking messages WHERE remoteFolderId = ? AND remoteUID IN (?,?,?,?,?,?,?,?,?) no longer present in remote range.
26404 [2021-09-07 13:00:08.511] [background] [critical]

*** Mailspring Sync
*** A C++ exception occurred during program execution:
*** database disk image is malformed

Is this an error that’s happened with an existing install, or something that’s happened with a new install?

Existing install. This seems to coincide with Windows randomly deciding that it needed to run a disk check during bootup. Once I was back in Windows, this happened.

I noticed today that 2 of the 5 accounts that are configured seem to be displaying no errors, however when I try to view an email in an account that appears to be working, I cannot view the email itself. The specific account however is showing new mail in the inbox list.

My Gmail based accounts however are still showing the same error as mentioned in my OP.

Is there a way to rebuild the database? Does it need to simply be deleted?

Yikes. Have you tried the ‘Reset cache’ button on the General preferences? I don’t know if that would help but it’s worth a shot. Beyond that, you may need someone who actually knows how the application works, I’m afraid! :face_with_monocle:

Worst case I uninstall/reinstall.

FWIW, I experienced the same error on my Linux machine. Apparently the database got corrupted after the machine suspended during an initial scan of my Gmail account.

Rebuilding cache was not possible due to database corruption. It got “solved” by deleting and re-adding the account.