[BUG] Incremental sync creates duplicate entries of the most recent email on every interval (Inclusive IMAP UID Fetch)
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 48/100
Research direction
Start by tracing the incremental IMAP sync path and how it records the latest UID; the issue does not name files or tests. Reproduce with an unchanged mailbox and inspect whether the highest UID is fetched and indexed again on each sync. Done means repeated syncs without new mail create no duplicate entries, while new messages are still imported.
Written by the indexing model from the issue text.
Description
Version
latest Docker image (rustmailer/bichon:latest)
Steps to Reproduce
- Configure an IMAP account in the Bichon Web GUI (reproduced both with a local Dovecot IMAP instance and directly via a remote Posteo IMAP mailbox).
- Allow the initial sync to complete fully (e.g., indexing ~4000 emails).
- Wait for the automatic background sync interval to trigger (or trigger a manual check) when no new emails have arrived on the server.
- Check the folders (e.g., Inbox or Sent) in the Bichon web interface.
Issue Description
Bichon creates duplicate entries of the exact same email—specifically the single most recent email (the highest UID) in every single folder—on every subsequent sync interval. For example, after 7 background sync cycles, the exact same sent email appears 7 identical times in the GUI.
Suspected Root Cause:
This appears to be an inclusive bounds issue ("off-by-one" logic error) during incremental IMAP fetching. When Bichon queries the server for new changes since the last sync, it likely requests a range like UID FETCH <Latest_Known_UID>:*.
According to the IMAP RFC, this range is inclusive. If no actual new emails exist on the server, the server faithfully returns the message that matches <Latest_Known_UID> again. Because Bichon does not seem to filter this out or increment the query cursor to <Latest_Known_UID> + 1 (i.e., UID FETCH <Latest_Known_UID+1>:*), it treats the returned message as a brand-new email and re-indexes it into the database on every single run.
- Dominant language
- Rust
- Stars
- 2.1k
- Forks
- 91
- Avg merge
- 14h 54m
- Merged PRs (30d)
- 6
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
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.
More from rustmailer/bichon
-
[BUG] Incremental sync warns "no stored highest_uid" on every round for folders with no new mailOpenbug
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
rustmailer/bichon#411 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 63/100
rustmailer/bichon#331 · 8 comments ·
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 48/100
rustmailer/bichon#409 · 4 comments ·
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 38/100
rustmailer/bichon#407 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 22/100
rustmailer/bichon#403 · 2 comments ·
All issues in rustmailer/bichon
Similar issues
-
bug UI
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
wardian-app/Wardian#1746 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
jlcodes99/cockpit-tools#3125 ·
Maintainers usually reply within 2 days
-
bug user-sprint
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Vondor/KassenSturz#967 ·
Maintainers usually reply within 1 day
-
area/ci
Difficulty 1/5 Under an hour Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
ImageGen generate-batch aborts valid JSONL jobs containing a Unicode line separator in poster textOpenbug imagen skills
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day