How to Fix a Corrupted Database in eM Client

Occasionally, the database of my eM Client Windows email app will get corrupted, usually after the power goes out unexpectedly. It’s easy to panic in this situation because it won’t let you view your email until the problem is fixed. But, it’s often not disastrous since you usually have a copy of your email in the cloud. Here’s how to recover from when this happens.

How eM Client Works

eM Client stores a local copy of your mail in SQLite databases on your computer’s hard drive, one database file for each folder. For most of these folders, you probably also have a copy in the cloud, so your email isn’t lost if the database gets corrupted.

But, if you dragged any folders to the Local Folders folder, then it’s only on your local hard drive. Same goes for your Archive folder, which stores email that you’ve auto-archived (if you’ve turned that feature on).

What the Failure Looks Like

After an unexpected power failure, when I restart eM Client, it goes through a database scanning process. You’ll know the database is corrupted if the scan ends with the error message, “Database verification and repairing failed. Please contact support team.”

eM Client checking for corrupted database
eM Client checking for corrupted database

Unfortunately, when the scan ends, the email address it gives bounces, and the “Restore Backup” button doesn’t do anything. So, I contacted eM Client support and filed a ticket there to get these steps to solve the problem.

Here are the steps to try:

1. Run a Disk Check on Your Drive

Close eM Client, then open Windows Explorer and right-click on the drive that the eM Client database folder is stored on. For most people, that will be drive C:. If you have multiple drives, you’ll need to search for your eM Client folder. Usually it is at “C:\Users\%username%\AppData\Roaming\eM Client”.

Select Properties, then click the Tools tab and click “Check” in the Error-checking section:

Windows Check Disk
Windows Check Disk

If any errors are found, approve fixing them. When done, reboot.

The last time I had a corrupted database, this fixed the problem!

2. Delete the Corrupted Database File

If eM Client still doesn’t start after fixing disk errors, the next thing to try is to delete the corrupted database file. When you get the eM Client error popup, click the button to show the detailed error message. It should look something like this:

Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 10: 'disk I/O error'.
at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)
at Microsoft.Data.Sqlite.SqliteCommand.PrepareAndEnumerateStatements(Stopwatch timer)+MoveNext()
at Microsoft.Data.Sqlite.SqliteCommand.GetStatements(Stopwatch timer)+MoveNext()
at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader()
at Microsoft.Data.Sqlite.SqliteCommand.ExecuteNonQuery()
at MailClient.Storage.Data.DataStore.GetConnectionInternal(String relativeName, Boolean privateConnection)
at MailClient.DbRepair.CorruptionChecker.CheckCorruption(RepairOptions repairOptions, CancellationToken token)
at MailClient.DbRepair.CheckingProcess.Check(CancellationToken token)
Data:
databaseFile: e29089c9-bffc-4d2f-9319-9267b66f3cca\f02d6d03-2fa4-4fde-99cc-05ad0cc72873\mail_index.dat

That last line starting with “databaseFile” is the important one. Navigate to your eM Client database folder, which is usually at “C:\Users\%username%\AppData\Roaming\eM Client”. Find the folder (not just the file) within it and delete it (or move it somewhere else temporarily).

Then restart eM Client. Unless that folder was a local-only folder, it will re-sync from the cloud and you’ll be good to go. If it was a local folder, you’ll have to restore it from backup, but local folders don’t get corrupted as often since they are not used as often.

3. Restore From Backup

If that doesn’t allow eM Client to restart, you can delete your entire database folder files (or move them somewhere else temporarily), and restore from backup.

Deleting or moving your database files will allow eM Client to restart. Then you can go to Menu -> File -> Restore and choose a backup file to restore.

4. Delete and Sync to the Cloud

If you don’t have a backup, you can delete (or move) your database files and restart eM Client. It will eventually sync with the cloud. Your local folders, however, will be lost.

To avoid that, you can try not deleting the files in the Archive and Local Folders folders. I haven’t tried this myself, but it might work.

eM Client should sync the other folders. However, once when I did this, I discovered that some of my folders were not getting synced to the cloud, and I lost those. So, only do this as a last resort.

How to Make Your Life Easier for Next Time…

After you get eM Client back up and running, it would be a good idea to set up backups by going to Menu -> Settings -> General -> Backup. There you can designate your backup directory and frequency. I suggest daily backups.

I also recommend creating shortcuts to your eM client database and backup directories on your desktop so they’re readily available the next time this happens.

After going through this experience, I also make it a habit to manually close eM Client before hibernating or powering down.

Finally, check to make sure that all of your important folders do indeed exist in the cloud, not just locally.

Did this help you? Please leave your questions or comments below! – Brian

Shares

Please Leave a Question or Comment

Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

1 Comment
Inline Feedbacks
View all comments
Dave Miller
Dave Miller
3 months ago

I had the following at the end of my detailed error message:

Data:
databaseFile: 1c1dd100-1760-40f7-861e-7a904ff2e7a9\b5483360-06a4-403d-94e3-6586c3735973\mail_fti.dat

I deleted the file and eM Client ran fine. No need to restore. Of course I got to this page after the eM Client wouldn’t restore and the email address to ask for solutions doesn’t work. I’m a bit disappointed that if this was my soulution the program couldn’t do it.