I received following error message in /var/mail/mail.err:

Jun 14 00:03:42 max dovecot: IMAP(bernhard): 
Corrupted index cache file /home/bernhard/Mail/.indexes/.imap/INBOX/dovecot.index.cache: 
Broken virtual size for mail UID 5618

What is the preferred way to restore the index?


According to this thread titled: IMAP Dovecot Error - Corrupted index cache 10.6.4 it sounds like you just need to do the following:


Re: IMAP Dovecot Error - Corrupted index cache 10.6.4

Nov 30, 2010 11:10 AM (in response to Scribit)

I am not sure if this is the best procedure and there may be unintended consequences, but this is what I did to resolve the issue.

I stopped the mail service.

From a shell, I navigated to each directory where an issue was reported.

In these directories, I renamed the following files, prepending them with "old."


EXAMPLE: mv dovecot.index old.dovecot.index

I then restarted the mail service. These 3 files were recreated for each IMAP folder on client access.

  • 3
    Thanks a lot. It is sufficient to delete the affected files and restart dovecot. It creates new index files after start..
    – user55518
    Jun 17 '14 at 21:20
  • Given that dovecot provides a tool to (re)build the index, shouldn’t doveadm index -u <username> INBOX do the trick?
    – dessert
    Aug 27 '19 at 7:11
  • @dessert I'd expect doveadm index to do exactly that but it seems it only adds unindexed emails to the index instead of completely rebuilding it.
    – cebe
    Mar 12 at 7:46

I find the easiest way to restore the index files is this.

Stop Dovecot

sudo systemctl stop dovecot

Rename, or delete, the entire .imap folder for any affected users (I prefer delete, but the cautious may feel otherwise)

sudo rm -R /home/bernhard/Mail/.indexes/.imap/

Start Dovecot

sudo systemctl start dovecot

When the mailbox is checked, Dovecot will simply recreate the indexes as if it were a new mailbox that it didn't see before, without missing a beat.


I had the same problem, deleting dovecot.index does not work, because some damaged email files corrupted dovecot.index again.


Error: Corrupted record in index cache file /home/user/mail/domain/username/.INBOX/dovecot.index.cache: UID 1227: Broken virtual size in mailbox INBOX: read(/home/user/mail/domain/username/.INBOX/cur/1600772501.M603394P22807.paxaa.host.com,S=9099624,W=9217854:2,S): FETCH BODY[] got too little data: 2846393 vs 9217854

Finally helped remove emails / restore from email backups that corrupted dovecot.index

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy