Occasionally, Webmail users (Horde or Roundcube) on cPanel server may see the following error: Server Error: UID SORT: Internal error occurred. Inbox may not load at all.
It's a permission issue which can be fixed by following command via Shell (root access is required):
/scripts/mailperm username
If it didn't fix, please check maillog:
/var/maillog
You should search for any errors associated with Dovecot imap. You may find something similar to:
Apr 24 21:53:23 lpd dovecot: imap(admin@helpdesk.westnic.net)<171192><CcpNFVGHLK4AAAAAAAAAAAAAAAAAAAAB>: Error: Mailbox INBOX: UID=36726: read(/home/hdesk/mail/helpdesk.westnic.net/admin/cur/1400063128.H889731P904282.lpd.westnic.net
In this case, it complains about single corrupted file:
/home/hdesk/mail/helpdesk.westnic.net/admin/cur/1400063128.H889731P904282.lpd.westnic.net
You can safely remove it then restart Dovecot within WHM > Restart Services > IMAP.