imap status inbox working uid fetch not working

If your IMAP client can check the STATUS or SELECT a mailbox but fails on UID FETCH, the issue typically stems from a mismatch between the client's requested sequence and the server's state, or a server-side bug. 

Common Causes or Fixes

Incorrect Message Set Range: A common syntax error is using * (asterisk) to mean "all messages".
Fix: Use 1:* instead of just *. In IMAP, * alone often refers only to the highest UID, whereas 1:* covers the entire range from the first to the last message.
UID Validity Change: If the server has a database error or has been reindexed, the UIDVALIDITY value might change.
Fix: Check the OK [UIDVALIDITY <value>] response after selecting the mailbox. If this value has changed, the client must discard its cached UIDs and refetch everything, as previous UIDs are no longer valid.
Server-Specific Bugs (Zimbra/Yahoo/Domino):
Zimbra/Yahoo: Some servers intermittently return "UID FETCH Server error" due to internal bugs.
IBM Domino: Does not strictly require UIDs to be returned in order when fetching a range (e.g., 1:*). Some clients fail if they receive UIDs out of sequence.
Extension Conflicts (UIDONLY): Some servers (like those in certain migration scenarios) may have UIDONLY enabled, which requires all commands to be UID-based. If your client mix-and-matches standard FETCH with UID FETCH, it may fail.
Corrupted Index Files: On servers like Dovecot, corrupted index files can cause messageset errors during a fetch.
Fix: (Server-side) Deleting the dovecot.index files in the mailbox folder usually forces a rebuild and resolves the issue. 

Quick Troubleshooting Steps

Check Selection: Ensure you have successfully sent a SELECT "INBOX" command before attempting the fetch.
Verify UID Existence: If you are fetching a specific UID (e.g., UID FETCH 500), use UID SEARCH ALL first to confirm that the UID still exists and hasn't been deleted or moved.
Test with Simple Syntax: Try a minimal command like a UID FETCH 1 (FLAGS) to see if basic metadata can be retrieved before trying to fetch the full BODY[]. 