Webmail users (Horde or Roundcube) on cPanel server may occasionally see the following error when attempting to access the mailbox: Server Error: UID SORT: Internal error occurred.
It's a permission issue which can be fixed by following Shell command:
ls -la /home/user/mail/domain.com/info/cur/
chow -R user.user /home/user/mail/domain.com/info/cur/
If not resolved, please check the maillog for further investigation:
grep domain.tld /var/log/maillog or cat /var/log/maillog | grep domain.tld
Move and corrupt files to a backup location and restart Dovecot
WHM > Restart Service > IMAP