bichon icon indicating copy to clipboard operation
bichon copied to clipboard

[BUG] "UID FETCH 30437:* returned no UIDs but server UIDNEXT=34819" after migration to 2.0.1

Open sotn3m opened this issue 3 months ago • 4 comments

Version

2.0.1

Steps to Reproduce

I have migrated from 1.6.2 to 2.0.1 (in docker) and perform the migration successfully. Before migration, I turned on bichon by accident for a moment.

Issue Description

A WARN in log, warning in UI. It repeats hourly (3 times so far).

Screenshots or Logs (optional)

2026-08-10T20:08:30.935+00:00 WARN bichon_core::imap::executor: Mailbox '[Gmail]/Wersje robocze': UID FETCH 30437:* returned no UIDs but server UIDNEXT=34819 (4382 messages in range). Refusing to advance highest_uid to avoid skipping them; the next sync will retry. account_id=XXX mailbox=[Gmail]/Wersje robocze start_uid=30437 uid_next=34819

sotn3m avatar Aug 10 '26 20:08 sotn3m

Same on 2.0.1, and it's not Gmail-Drafts-specific — reproduced across Gmail (Sent/Drafts/labels), Yahoo (Sent/Notes with inflated UIDNEXT gaps up to ~420k), Outlook, Yandex, and Proton. Common factor: any mailbox where UIDNEXT is ahead of the highest existing UID (deleted/expunged/unlabeled trailing messages, or Yahoo's inflated counter). A full "Backfill missing emails" enumerate also returns found=0, so it never converges. No data loss — the messages are genuinely gone (on Gmail the content is still in [Gmail]/All Mail).

Two things that might help:

  • Workaround / mechanism: adding one real message to the stuck folder unsticks it — the next fetch returns a live UID at uid_next and bichon advances past the whole phantom range in one step. So it only gets stuck when the phantom UIDs are at the very tail with nothing beyond them.
  • Possible fix: when a clean, complete UID FETCH <highest+1>:* returns zero UIDs, treat the tail range as empty and advance highest_uid to uid_next-1; only refuse on a truncated/errored fetch (the #340 case).

oravanest avatar Aug 13 '26 05:08 oravanest

I can confirm suggested workaround worked for my case. Thank you.

sotn3m avatar Aug 13 '26 20:08 sotn3m

This is indeed a problem. I'll handle this part of the logic carefully. Thanks for the feedback.

rustmailer avatar Aug 19 '26 07:08 rustmailer

Instead of advancing directly, should not treat this as a failure either. Remove the warn log and change it to info. When new emails arrive, it will naturally advance.

rustmailer avatar Aug 19 '26 09:08 rustmailer