Skip to content

[fix] Unexpected EOF Errors During mbsync Sessions #425

@oneingan

Description

@oneingan

Describe the bug

Node.js version: N/A (client-side issue with mbsync/isync 1.5.1; potential server-side IMAP compatibility problem).

OS version: NixOS (unstable, kernel 6.10.x).

Description: mbsync (isync 1.5.1) encounters "IMAP error: unexpected EOF" from imap.forwardemail.net:993 (TLSType IMAPS). For small syncs, it completes but errors after LOGOUT. For ~50+ emails, it aborts mid-sync, requiring multiple runs to finish.

Actual behavior

  • Small changes: Sync succeeds, EOF after LOGOUT (no "* BYE" or "OK LOGOUT").
  • Large changes: Partial sync (e.g., first run: Far +2 Near +6; second: Near +50), then EOF mid-process.
  • Resumes on retry, but unreliable.

Example logs (two runs with ~50 emails):

❯ mbsync example
IMAP error: unexpected EOF from imap.forwardemail.net (121.127.44.70:993)
Channels: 1 Boxes: 6 Far: +2 *6 #0 -0 Near: +6 *0 #0 -0
~ took 16s
❯ mbsync example
IMAP error: unexpected EOF from imap.forwardemail.net (121.127.44.70:993)
Channels: 1 Boxes: 6 Far: +0 *0 #0 -0 Near: +50 *0 #0 -0

Verbose log (EOF after LOGOUT in completed sync):

(...)
F: >>> 22 LOGOUT
F: [ 41] Callback leave close_box
IMAP error: unexpected EOF from imap.forwardemail.net (121.127.44.70:993)
Channels: 1 Boxes: 6 Far: +0 *0 #0 -0 Near: +1 *0 #0 -0

Expected behavior

  • Clean session closure with proper responses to CLOSE/LOGOUT.
  • Full sync in one run, no mid-sync aborts.

Code to reproduce

Config (~/.config/isyncrc):

IMAPAccount example
CertificateFile /etc/ssl/certs/ca-certificates.crt
Host imap.forwardemail.net
PassCmd "echo 'REDACTED'"
Port 993
TLSType IMAPS
User *@example.com

IMAPStore example-remote
Account example

MaildirStore example-local
Inbox ~/.mail/example/Inbox
Path ~/.mail/example/
SubFolders Verbatim

Channel example
Create Near
Expunge Both
Far :example-remote:
Near :example-local:
Patterns *
Remove Both
SyncState *

Run mbsync -V example with ~50 new emails for mid-sync failure.

Checklist

  • I have searched through GitHub issues for similar issues.
  • I have completely read through the README and documentation.
  • I have tested my code with the latest version of Node.js and this package and confirmed it is still not working. (N/A; tested with latest mbsync/ForwardEmail IMAP as of Sept 2025.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions