Mail stopped working recently; updating to 5.1.1 did not help. When attempting to use the Mail app, the web console reports errors like
ServiceException IMAP error synchronizing account 5: No password provided.
Could not load account mailboxes: IMAP error synchronizing account 5: No password provided.
Around the same time, I started seeing errors in the logs like
NoUserException Backends provided no user object
and
Horde_Imap_Client_Exception No password provided.
Error while running background job OCA\Mail\BackgroundJob\QuotaJob (id: 14118, arguments: {"accountId":5})
It seems the Calendar app is similarly affected.