Fixing duplicate UID errors when using mbsync and mu4e

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)


  1. Any chance you documented your transition? I have contemplated this switch too, but I haven’t wanted to mess up my email mid semester 😉


    1. I’m also mid-semester but thought I’d take my chances. There wasn’t much to document really, but I’ll put together a quick post to describe what I did so I can format it more nicely…


  2. Dang I’m having this exact same problem with gnus, or at least the same symptom… I wonder if there’s an equivalent option in gnus…


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s