Fixing "database disk image is malformed - while executing PRAGMA foreign_key_check"

If MacWhisper shows a Database Error when it opens, ending with:

SQLite error 11: database disk image is malformed - while executing PRAGMA foreign_key_check

the database file holding your transcriptions has been damaged. That's almost always caused by something outside the app: a cloud sync tool syncing your Library folder (Dropbox, OneDrive, Google Drive and similar), a "cleaner" or antivirus app, a full disk, or an unexpected shutdown. The app noticed the damage while upgrading its database after an update, and stopped without changing anything.

You can fix it by restoring one of the automatic backups the app keeps.

1. Open the folder in Finder

Click Show in Finder in the error alert. Or, in Finder, press Cmd+Shift+G and paste:

  • MacWhisper (from our website): ~/Library/Application Support/MacWhisper/
  • Whisper Transcription (Mac App Store): ~/Library/Containers/com.goodsnooze.MacWhisper/Data/Library/Application Support/MacWhisper/

2. Find the backup

Open the Database folder, then Backups. Each backup is a folder named premigration-  followed by a number.

Use the second-highest number. The highest one was made at the moment the error appeared, from the already damaged database. Your library will come back as it was on that backup's date (shown in the Date Modified column in List view).

If there's no Backups folder, or only one backup inside it, contact us instead (see below).

3. Copy the Database folder

Go back to the folder from step 1, select the Database folder and press Cmd+D. Keep the resulting Database copy until everything works: it holds the damaged database, which we can often recover newer transcriptions from, and all your audio files.

4. Quit MacWhisper

If MacWhisper is still open, quit it. It must not be running while you swap the files.

5. Swap the database files

  1. In the Database folder, move every file whose name starts with main.sqlite  to the Trash: main.sqlite , main.sqlite-wal  and main.sqlite-shm  (Finder may show the first as just main). Leave ExternalMedia and Backups alone.
  2. Open the backup folder you picked in step 2, select everything inside (Cmd+A), copy it (Cmd+C), go back to the Database folder and paste (Cmd+V).

Make sure all of the old main.sqlite  files are gone: a leftover -wal  or -shm  file from the damaged database would damage the restored one too.

6. Relaunch MacWhisper

The first launch can take a little longer while the app upgrades the restored database. If the same error appears again, repeat step 5 with the next older backup.

Still stuck?

If you don't have a usable backup, or you need transcriptions made after the backup's date, email us at support@macwhisper.com and keep Database copy. We can often recover them from the damaged file.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.