Fetch error on folder letter case mismatch
@gilleslamiral is already working on this.
Since May 18, 2026.
- Dominant language
- Shell
- Stars
- 4.2k
- Forks
- 531
- PR merge metrics
- No merged PRs in 30d
Description
Hi.
When migrating between servers which have the same folder names in different letter casings, something seems to go wrong when trying to list the contents of the directory on the destination. As it tries to calculate the folder sizes, imapsync spits out an error for the folder on host2:
Host2 Folder Folder: Could not select: 17 NO Mailbox doesn't exist: Folder (0.001 + 0.000 secs).
Host1 folder 3/7 [Folder] Size: 52268 Messages: 5 Biggest: 15308
Host2 folder 3/7 [Folder] does not exist yet
Host2-Host1 -52268 -5 -15308
After that, the folder is created correctly on the destination, so I end up having both folder and Folder as I would expect.
If neither folder nor Folder exists on the destination, it will just say "does not exist yet". The "Could not select" error only appears when I have a similarly named folder on the destination with different casing. Running the sync again will cause it to succeed, as the folder with the same casing as the source now exists.
This causes imapsync to exit with an error code, despite everything being migrated correctly:
The sync looks good, all 30 identified messages in host1 are on host2.
There is no unidentified message on host1.
The sync is strict, all 30 identified messages in host2 are on host1.
Detected 1 errors
Check if a new imapsync release is available by adding --releasecheck
Homepage: https://imapsync.lamiral.info/
++++ Listing 1 errors encountered during the sync ( avoid this listing with --noerrorsdump ).
Err 1/1: Host2 Folder Folder: Could not select: 17 NO Mailbox doesn't exist: Folder (0.001 + 0.000 secs).
The most frequent error is ERR_SELECT.
Exiting with return value 117 (EXIT_ERR_SELECT) 1/50 nb_errors/max_errors PID 1077313
Both the source and destination are dovecot on Linux with a case sensitive file system and maildir format.
Here's the full log file: imapsync.txt
On a separate note: Is it possible, with one of the regex options or similar, to make it match directories in a case insensitive manner, so that Drafts will be synced to either of drafts, Drafts or DRAFTS? We seem to be running into this issue somewhat occasionally, and it would be nice if we didn't have to map the folders manually :)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.