This is a particularly niche post but hopefully will save someone the time I spent trying to solve this problem.
I have migrated from offlineimap to mbsync (part of isync) for synchronising my local email with Gmail. mbsync is much faster and I’ve been happy with the switch but I kept encountering error messages from mbsync about duplicate UIDs. The form of the message was
Maildir error: duplicate UID 12 (or some other number).
After a lot of digging around I found the solution was in the mbsync and mu4e manuals (of course). The problem is caused because mu4e does not by default rename files when moving them to a new directory and this then causes problems for mbsync. This is easily fixed by setting
(setq mu4e-change-filenames-when-moving t)