Problem with Mail APP, can not delete mails

I have recently started working with the Mail APP in Nextcloud. I connect my mailboxes with IMAP.
Everything works at the beginning, but at some point the inbox just stops synchronizing. Mails are still displayed but I can no longer delete them and the inbox no longer corresponds to the inbox at the provider? I have already removed and reintegrated the mailbox several times. It remains as described, at the beginning everything is correct, at some point mails can no longer be deleted.

The following error message appears.
“Could not delete message” and this is in the log from the admin:

Error	mail	ServiceException Could not load message 	
Error	mail	Exception OCA\Mail\IMAP\MessageMapper::move(): Return value must be of type int, null returned in file '/var/www/html/custom_apps/mail/lib/IMAP/MessageMapper.php' line 345 	
Error	PHP	Undefined array key 460 at /var/www/html/custom_apps/mail/lib/IMAP/MessageMapper.php#345 
Error	mail	ServiceException Could not load message

Has anyone ever had a problem like this?