Critical Bug: System.InvalidCastException (Int32 to Int64) during IMAP Sync - Version 10.4.4756

Description:

App Version: 10.4.4756+b9be9aa001 (Windows 11) Account Type: Gmail / Google Workspace

Issue: I am experiencing a recurring System.InvalidCastException during the synchronization of the “All Mail” folder. The error log specifies: Unable to cast object of type 'System.Int32' to type 'System.Int64' at MailClient.Protocols.Common.ItemSynchronizeContext.StoreItems.

Steps taken to resolve (without success):

  1. Deleted the email account and re-added it.
  2. Performed a clean installation by deleting the %AppData%\eM Client folder.
  3. Used the /DbRepair tool.

The error appears immediately after a fresh setup as soon as the IMAP synchronization starts downloading headers/items from the “All Mail” folder. It seems to be a regression in how the client handles Large UIDs or metadata from Gmail’s IMAP server in this specific build.

Error Log Snippet:

[IMAP] System.InvalidCastException: Unable to cast object of type 'System.Int32' to type 'System.Int64'.
   at MailClient.Protocols.Common.ItemSynchronizeContext`2.StoreItems[TUid,TVid](SynchronizationType synchronizationType, IEnumerable`1 newItems, Dictionary`2 uniqueIdToVersionId, Dictionary`2 uniqueIdToOid)
   at MailClient.Protocols.Common.MailItemSynchronizeContext.StoreItems[TUid,TVid](SynchronizationType synchronizationType, IEnumerable`1 newItems, Dictionary`2 uniqueIdToVersionId, Dictionary`2 uniqueIdToOid)

Please let me know if you need further logs or if there is a hotfix available for this data type mismatch.

Hi, yes, let’s get more logs please:

  1. Export your account to a xml file via Menu > File > Export.
  2. Launch eM Client in Offline Mode: when the splash screen opens, hold Ctrl and confirm that you want to open in Offline Mode.
  3. Import the account from the xml file (Menu > File > Import).
  4. Go to Menu > Settings > Advanced .
  5. Enable logging for IMAP for the account.
  6. Close eM Client and open it in Offline Mode again.
  7. Turn the mode off (click Offline at the top).
  8. Wait for the error.
  9. Go to Help > Open Log Directory in the menu.
  10. Send the files from the folder either to [email protected] or here via DMs

I have the same issue on one of my three IMAP accounts since some days. Today I’ve updated to version 10.4.4867, the problem is still there.

Please keep me informed as well.
Thanks.

Update: I tried some things with my webmail access and I recognized that the ‘deleted’ folder had a lot of messages. So I purged them all manually. And now after purging, the synchronization in eM client works again.

Hello,

Same issue here, for 4 of my 7 IMAP accounts.
I just updated to version 10.4.4867, but the problem persists.

I have the same problem. After disabling Kaspersky, it works perfectly.

Anyone still running into this: could you send me the logs as describe above?

(Or please let me know if you have and it escaped my attention)

I can confirm that disabling Kaspersky also resolves the issue in my case.
And re-enabling it after retrieving emails no longer triggers any errors.

Good catch!

And re-enabling it after retrieving emails no longer triggers any errors.

Yes, exactly like that!