Mail.app keeps crashing: Got EXPUNGE but EXISTS is already 0 Mail.app on my High Sierra (it also did this on Sierra too) keeps crashing. In the error report I see that it always crashes with the same error:

Got EXPUNGE but EXISTS is already 0.

What does this mean and how do I avoid crashes?
I had the same problem, with it happening a few times a day but only when sending email. Rebuilding the mailbox did not help. 

Eventually I found that I was storing draft messages on the server. This is picked in Mail > Preferences > someemailaccount > Mailbox Behaviours > Drafts Mailbox. 

I changed that to a local "On My Mac" setting. I have not had a single error today and yesterday since doing so!

I think what was happening was my mail provider was sending the message and deleting the message from drafts, in the meantime, Apple Mail wanted to delete the message from drafts, and, they clashed depending on which happened first.