At times, Dovecot started spewing messages into dovecot.log about a corrupted index cache file because of “Broken MIME parts”. This happened on Ubuntu/Xenial with dovecot_2.2.22-1ubuntu2.2:

imap: Error: Corrupted index cache file dovecot.index.cache: Broken MIME parts
      for mail UID 33928 in mailbox INBOX: Cached MIME parts don't match
      message during parsing: Cached header size mismatch (parts=4100...)
imap: Error: unlink(dovecot.index.cache) failed: No such file or directory (in
      mail-cache.c:28)
imap: Error: Corrupted index cache file dovecot.index.cache: Broken MIME parts
      for mail UID 33971 in mailbox INBOX: Cached MIME parts don't match
      message during parsing: Cached header size mismatch (parts=)

The problem appears to be fixed in 1bc6f1c.

Download the patch to the deb-package for Ubuntu/Xenial.

Patch instructions:

$ apt-get source dovecot
$ patch -p0 < dovecot_2.2.22-1ubuntu2.2--osso1.patch
$ cd dovecot-2.2.22
$ DEB_BUILD_OPTIONS="nocheck" dpkg-buildpackage -us -uc -sa

patch xenial dovecot ubuntu