I'm syncing mail from an IMAP server to local Maildirs with doveadm backup -R
, and I sometimes get an error the second time I sync an account:
Mailbox INBOX sync: mailbox_delete failed: INBOX can't be deleted.
I've figured out that the sync completes the first time without an error, but the UIDVALIDITY of the INBOX Maildir doesn't match the UIDVALIDITY on the IMAP server. Then the second time doveadm detects the mismatch and wants to delete the INBOX, but it can't because Maildir INBOXes can't be deleted.
So I think the root cause is that the INBOX is being created with the wrong UIDVALIDITY in the first place. It only seems to happen when there are no messages in the INBOX on the server at the time the Maildir is created, but it doesn't seem to happen all the time.
Is there anything I can do to make the sync job run smoothly?
Andy