Mailspring keeps disconnecting from gmail account

Hey guys, was browsing these Gmail sync problem topics because of the same problem. I switched to other email clients because of it, eventhough I’m paying for mailspring’s online services. But nothing works as nice for me like Mailspring. Thunderbird is too slow, Geary doesn’t give a unified inbox, Evolution just, not my thing. I even set up my gmails to “waterfall” into each other so I could see them all from 1 inbox on the web, but that wasn’t what works well for me, managing all the aliases like that. And the what about my Roundcube servers? So, the way I got it working for me is explained below: (P.S. thank for reading my blog, like and subscribe.)

  1. wipe all the mailspring data (sudo apt purge mailspring, and also make sure it gets the ~/.config/Mailspring directory)
  2. secure your gmails with 2-factor (authenticator, SMS, phone prompt etc.) if you haven’t already (you can’t make an app password unless you have 2-factor enabled)
  3. make an app password for mailspring
  4. set up the accounts as imap
  5. yes, Mailspring, for the 10th time, I really really want to setup gmail as an imap!
  6. check your folders in Mailspring settings. Several of my accounts show (None) for the Archive folder, and others show ‘Archive’ so not sure, but things are in fact working as I expect.

If it’s any added benefit, it seems faster now that when I used the “proper” Oauth login.

Creating the app passwords and 2FA was a bit of a hassle, but overall it’s less time than it took me to configure Thunderbird and the waaaaaaaaaaaaaiiiiiit for it to process emails.

5 Likes

I had a similar problem, but out of the 3 gmail accounts I use, only 2 give that problem. I noticed that 2 factor authentication was on in the account without problems, and tried that.

It doesn’t seem to have worked, so I’ll try this when I get the message again.

This worked. Thank you. Unfortunately, IMAP does not display Gmail’s inbox labels.

Well, I tried making the imap and deleting the whole app and it seems to keeep being an isue, as I just received the same problem again in all the accounts (In the ones I had with imap, the one I left without imap, and even in the one with office 365, which suppossedly didn’t have that problem). Strangely, the first account I connected still does not give me any kind of error, weird…

well, It seems it’s reconnecting time every so often…

Now IMAP is having the same issue that OAuth did previously.

1 Like

Hi, same problem here. I attach the error message for completeness.
I will also try to remove and reinstall everything during the weekend.

Mailspring Version: 1.10.8-8ea2a61f
Platform: linux
Account State: sync_error
Account Provider: gmail
IMAP Server: imap.gmail.com
SMTP Server: smtp.gmail.com
--------------------------------------------
**...warning messages about private emails...**
9970 [2023-03-28 09:30:16.077] [background] [info] syncFolderUIDRange for [Gmail]/Tutti i messaggi, UIDs: 194419 - 196072, Heavy: false
9970 [2023-03-28 09:30:16.276] [foreground] [info] [local-42ee1479-3d93] Running EventRSVPTask performRemote:
9970 [2023-03-28 09:30:16.277] [foreground] [critical] 
***
*** Mailspring Sync 
*** A JSON exception occurred during program execution: 
*** [json.exception.type_error.302] type must be string, but is null
***

10020 [2023-03-28 09:30:16.844] [main] [info] Identity created at 1644062718 - using ID Schema 1
10020 [2023-03-28 09:30:16.845] [main] [info] ------------- Starting Sync (MYEMAIL@gmail.com) ---------------
10020 [2023-03-28 09:30:16.852] [metadata] [info] Metadata delta stream starting...
10020 [2023-03-28 09:30:18.849] [background] [info] Fetching XOAuth2 access token (gmail) for 308ff103
10020 [2023-03-28 09:30:18.953] [background] [info] Marking all folders as `busy`
10020 [2023-03-28 09:30:18.954] [background] [info] Syncing folder list...
10020 [2023-03-28 09:30:20.623] [background] [info] Syncing folder list...
10020 [2023-03-28 09:30:21.001] [background] [info] syncFolderUIDRange for [Gmail]/Tutti i messaggi, UIDs: 196067 - 196072, Heavy: true
10020 [2023-03-28 09:30:21.368] [background] [info] - [Gmail]/Tutti i messaggi: remote=4, local=4, remoteUID=mH7CJgpnLchqUC6uNEorzrD8JoKGBDWqZjQJ3aw2
**...warning messages about private emails...**
10020 [2023-03-28 09:30:22.015] [background] [info] syncFolderUIDRange for [Gmail]/Tutti i messaggi, UIDs: 194419 - 196072, Heavy: false
10020 [2023-03-28 09:30:22.183] [foreground] [info] [local-42ee1479-3d93] Running EventRSVPTask performRemote:
10020 [2023-03-28 09:30:22.183] [foreground] [critical] 
***
*** Mailspring Sync 
*** A JSON exception occurred during program execution: 
*** [json.exception.type_error.302] type must be string, but is null
***

I already tried that and it didn’t work for me, tell us what you did if it works!!

Hi, I actually solved using the “Rebuild Cache…” button after doing the “Re-authenticate…”.
Everything is working now for me.

Yeah, this happens every now and then after a failure in mail send…

I suppose it wouldn’t be too hard to handle though.

Happened to me every now and then too, becoming way too frequent this year (at least 1 a month or 1 every 2 weeks), now I can’t even use mailspring anymore starting from this afternoon. It just won’t sync anymore with any of my 3 gmail accounts, resyncing doesn’t do anything, reinstalling doesn’t do anything, It would be able to send the test emails but that’s as far as it can go, no email is ever loaded no matter how many time I try syncing.

Also, it doesn’t happen on any other email client so far and I’ve tried quite a few this afternoon so the issue is with google and mailspring, please, find a fix for this, I really like this app but I can’t realistically go without email not even for a day and if I switch, it’s unlikely I would ever return back…

1 Like

This issue now happens anytime I close and reopen the Mailspring app. With three Gmail accounts, it’s pretty much unusable.

The lack of developer engagement on this topic is not confidence inspiring.

I use Mailbird for my work and main personal accounts and Mailspring for my other personal accounts. This is because both have Gmail shortcuts.

Any suggestions for another Windows mail client that offers Gmail shortcuts?

3 weeks later and there is no sign of anything in response to this, and scanning the forums, there seems to be no activities from the dev at all so I think the project is dead.

It have been overall a good experience when things were working, farawell Mailspring!

Now it happens almost every day. I paste the error code for completeness:

Mailspring Version: 1.10.8-8ea2a61f
Platform: win32
Account State: invalid
Account Provider: gmail
IMAP Server: imap.gmail.com
SMTP Server: smtp.gmail.com
--------------------------------------------
78388 [2023-06-13 20:31:30.445] [metadata] [info] Metadata delta stream starting...
78388 [2023-06-13 20:31:32.372] [background] [info] Fetching XOAuth2 access token (gmail) for 5fb7845f
78388 [2023-06-13 20:31:33.379] [background] [critical] 
***
*** Mailspring Sync 
*** An exception occurred during program execution: 
*** {"debuginfo":"https://www.googleapis.com/oauth2/v4/token RETURNED {\n  \"error\": \"invalid_grant\",\n  \"error_description\": \"Bad Request\"\n}","key":"Invalid Response Code: 400","retryable":false,"what":"Unknown exception"}
***

48944 [2023-06-13 20:31:33.955] [main] [info] Identity created at 1608143958 - using ID Schema 1
48944 [2023-06-13 20:31:33.959] [main] [info] ------------- Starting Sync (davo.enterprise@gmail.com) ---------------
48944 [2023-06-13 20:31:33.970] [metadata] [info] Metadata delta stream starting...
48944 [2023-06-13 20:31:35.977] [background] [info] Fetching XOAuth2 access token (gmail) for 5fb7845f
48944 [2023-06-13 20:31:36.572] [background] [critical] 
***
*** Mailspring Sync 
*** An exception occurred during program execution: 
*** {"debuginfo":"https://www.googleapis.com/oauth2/v4/token RETURNED {\n  \"error\": \"invalid_grant\",\n  \"error_description\": \"Bad Request\"\n}","key":"Invalid Response Code: 400","retryable":false,"what":"Unknown exception"}
***

41624 [2023-06-13 20:31:36.797] [main] [info] Identity created at 1608143958 - using ID Schema 1
41624 [2023-06-13 20:31:36.800] [main] [info] ------------- Starting Sync (davo.enterprise@gmail.com) ---------------
41624 [2023-06-13 20:31:36.813] [metadata] [info] Metadata delta stream starting...
41624 [2023-06-13 20:31:38.819] [background] [info] Fetching XOAuth2 access token (gmail) for 5fb7845f
41624 [2023-06-13 20:31:39.435] [background] [critical] 
***
*** Mailspring Sync 
*** An exception occurred during program execution: 
*** {"debuginfo":"https://www.googleapis.com/oauth2/v4/token RETURNED {\n  \"error\": \"invalid_grant\",\n  \"error_description\": \"Bad Request\"\n}","key":"Invalid Response Code: 400","retryable":false,"what":"Unknown exception"}
***

71520 [2023-06-13 20:31:39.701] [main] [info] Identity created at 1608143958 - using ID Schema 1
71520 [2023-06-13 20:31:39.703] [main] [info] ------------- Starting Sync (davo.enterprise@gmail.com) ---------------
71520 [2023-06-13 20:31:39.728] [metadata] [info] Metadata delta stream starting...
71520 [2023-06-13 20:31:41.746] [background] [info] Fetching XOAuth2 access token (gmail) for 5fb7845f
71520 [2023-06-13 20:31:42.468] [background] [critical] 
***
*** Mailspring Sync 
*** An exception occurred during program execution: 
*** {"debuginfo":"https://www.googleapis.com/oauth2/v4/token RETURNED {\n  \"error\": \"invalid_grant\",\n  \"error_description\": \"Bad Request\"\n}","key":"Invalid Response Code: 400","retryable":false,"what":"Unknown exception"}
***

And with the office 365 account:

Mailspring Version: 1.10.8-8ea2a61f
Platform: win32
Account State: sync_error
Account Provider: office365
IMAP Server: outlook.office365.com
SMTP Server: smtp.office365.com
--------------------------------------------
76600 [2023-06-12 21:13:04.419] [background] [info] - Bandeja de salida: remote=0, local=0, remoteUID=4zNDKBp4G4uRkzJBzgoJzhWsa4rxtnXrNu9dESMhK
76600 [2023-06-12 21:13:04.454] [background] [info] syncFolderUIDRange for Calendario, UIDs: 1 - 112, Heavy: false
76600 [2023-06-12 21:13:04.597] [background] [info] - Calendario: remote=3, local=3, remoteUID=qXTftd5BdtW9LUWv9owPway6YNwbEQP3NP5kMENQv
76600 [2023-06-12 21:13:04.630] [background] [info] syncFolderUIDRange for Calendario/Cumplea&APE-os, UIDs: 1 - 1, Heavy: false
76600 [2023-06-12 21:13:04.702] [background] [info] - Calendario/Cumplea&APE-os: remote=0, local=0, remoteUID=QQJJUPJduXtrBsJc7at8QygQEyVdqcCf1Jhd9sknv
76600 [2023-06-12 21:13:04.736] [background] [info] syncFolderUIDRange for Calendario/D&AO0-as festivos de Espa&APE-a, UIDs: 1 - 159, Heavy: false
76600 [2023-06-12 21:13:04.841] [background] [info] - Calendario/D&AO0-as festivos de Espa&APE-a: remote=78, local=78, remoteUID=nrVYYfpNuCMA6qqpFVkoR69TnsPzN6Lbhvd19jp2G
76600 [2023-06-12 21:13:04.877] [background] [info] syncFolderUIDRange for Contactos, UIDs: 1 - 1, Heavy: false
76600 [2023-06-12 21:13:04.949] [background] [info] - Contactos: remote=0, local=0, remoteUID=gWpJbsczHcTrCeyfq9XKuXuqufNnhgnGTLw8CrnkM
76600 [2023-06-12 21:13:04.983] [background] [info] syncFolderUIDRange for Diario, UIDs: 1 - 1, Heavy: false
76600 [2023-06-12 21:13:05.054] [background] [info] - Diario: remote=0, local=0, remoteUID=VCESrSbLTgi3va11Hn5z5nwweeKUUWGccieRuxKK1
76600 [2023-06-12 21:13:05.088] [background] [info] syncFolderUIDRange for Historial de conversaciones, UIDs: 1 - 1, Heavy: false
76600 [2023-06-12 21:13:05.169] [background] [info] - Historial de conversaciones: remote=0, local=0, remoteUID=eKeeVVtN5UhEJ4Wdn5sGU14XjDrfyhBXVR4oL1bjA
76600 [2023-06-12 21:13:05.204] [background] [info] syncFolderUIDRange for Mailspring, UIDs: 1 - 1, Heavy: false
76600 [2023-06-12 21:13:05.275] [background] [info] - Mailspring: remote=0, local=0, remoteUID=MssSx9bNqYAzTZk6zUGMfaVwyadeWDgDpaCcQH7QK
76600 [2023-06-12 21:13:05.403] [background] [info] syncFolderUIDRange for Mailspring/Snoozed, UIDs: 1 - 1, Heavy: false
76600 [2023-06-12 21:13:05.711] [background] [info] - Mailspring/Snoozed: remote=0, local=0, remoteUID=Xz9WuBZ5sqnA82jGq3i6mb6kjrvXU4xJawNy7HvCa
76600 [2023-06-12 21:13:05.847] [background] [info] syncFolderUIDRange for Notas, UIDs: 1 - 1, Heavy: false
76600 [2023-06-12 21:13:06.024] [background] [info] - Notas: remote=0, local=0, remoteUID=rPzSushMqPhY287Hnujh5CyXZG7SmZsDPnCZ5XVDy
76600 [2023-06-12 21:13:06.168] [background] [info] syncFolderUIDRange for Tareas, UIDs: 1 - 1, Heavy: false
76600 [2023-06-12 21:13:06.332] [background] [info] - Tareas: remote=0, local=0, remoteUID=sHmhJUDUqizDHVrcqiHsr8d6mnYanZnoP6iwYp1hb
76600 [2023-06-12 21:13:06.333] [background] [info] Sync loop deleting unlinked messages with phase 1.
76600 [2023-06-12 21:13:06.333] [background] [info] Sync loop complete.

And now, the only gmail account that didn’t give any problems is having the same problem too. I have to re-connect them daily or even twice a day…

1 Like

I’m having this issue with two seperate gmail accounts on two differnt computers (windows and linux) and I’ve had to stop using mailspring and go back to thunderbird. It’s a shame because when it works mailspring is a much better product.

I think it’s solved now with the new update!!

I am still experiencing this issue on Linux. Not sure if this has been solved yet. I currently have the latest version from Flatpak.

I have the same issue. One of my gmail accounts started getting disconnected. It sometimes reconnects when hitting the try again and goes back to issues 1 minute later…

I also have the issue on Linux with latest flatpak. Running on OpenSuse Tumbleweed.

1 Like