UID MOVE: IMAP session state is inconsistent, please relogin.

UID MOVE: IMAP session state is inconsistent, please relogin.

On cPanel emails are stored by default in Maildir format where each email is stored as a separate file in the /home/user/mail/domain/email//cur directory. On older systems and even cPanel in the past used Mbox format as the default where many emails are stored in the same file on the server. Even today, some servers still use it and the following error happened when trying to move/delete email that are stored in a corrupt mbox file:

image 19 - UID MOVE: IMAP session state is inconsistent, please relogin.

the following errors are logged in the maillog

Mar 12 09:29:52 s8 dovecot: imap(email@XXXX.com)<122323><umFMQAHan35/AAAB>: Error: mdbox rebuild: Failed to fix file /home/XXXXXX/mail/XXXX.com/desk/storage/m.921
Mar 12 09:29:52 s8 dovecot: imap(email@XXXX.com)<122323><umFMQAHan35/AAAB>: Warning: fscking index file /home/XXXXXX/mail/XXXX.com/desk/storage/dovecot.map.index
Mar 12 09:29:52 s8 dovecot: imap(email@XXXX.com)<122323><umFMQAHan35/AAAB>: Warning: mdbox /home/XXXXXX/mail/XXXX.com/desk/storage: rebuilding indexes
Mar 12 09:29:52 s8 dovecot: imap(email@XXXX.com)<122323><umFMQAHan35/AAAB>: Error: Corrupted dbox file /home/XXXXXX/mail/XXXX.com/desk/storage/m.555 (around offset=0): EOF while reading file header
Mar 12 09:29:52 s8 dovecot: imap(email@XXXX.com)<122323><umFMQAHan35/AAAB>: Error: mdbox rebuild: Failed to fix file /home/XXXXXX/mail/XXXX.com/desk/storage/m.555
Mar 12 09:29:52 s8 dovecot: imap(email@XXXX.com)<122323><umFMQAHan35/AAAB>: Error: Corrupted dbox file /home/XXXXXX/mail/XXXX.com/desk/storage/m.921 (around offset=54): Invalid dbox version
Mar 12 09:29:52 s8 dovecot: imap(email@XXXX.com)<122323><umFMQAHan35/AAAB>: Error: mdbox rebuild: Failed to fix file /home/XXXXXX/mail/XXXX.com/desk/storage/m.921

If we enter the directory where emails are stored: /home/user/domain/email/ we can see that the cur & new folders used by maildir format are empty, and that emails are stored in storage folder typical for mbox format. We can also notice the corrupted (broken) mbox files.

image 20 - UID MOVE: IMAP session state is inconsistent, please relogin.

To fix this issue caused by corrupted mbox files, we can convert the format for this cPanel user from mdbox to maildir. navigate to WHM > Mailbox Conversion select convert to maildir

image 21 - UID MOVE: IMAP session state is inconsistent, please relogin.

Choose the account and click on Next

image 22 1024x305 - UID MOVE: IMAP session state is inconsistent, please relogin.

on the next screen just confirm the selection:

image 23 - UID MOVE: IMAP session state is inconsistent, please relogin.

After all emails are transferred from mbox format to maildir, you can delete storage and mailboxes folders from that account to free disk space. Email move/delete now should work as usual.


To check if any other accounts on the server still use mbox format you can simply search for the storage folders:

find /home/*/mail/* -iname 'storage*'
whoami
Stefan Pejcic
Join the discussion

I enjoy constructive responses and professional comments to my posts, and invite anyone to comment or link to my site.