Error Could not get message flag options from IMAP: IMAP error reported by server.
Open
@kesselb is already working on this.
Since Aug 6, 2026.
1. to develop
bug
- Dominant language
- JavaScript
- Stars
- 1k
- Forks
- 348
- Avg merge
- 12h 28m
- Merged PRs (30d)
- 91
Description
Steps to reproduce
- Install newest Mail app v. 5.10.9
- Setup an iCloud Account with NC Server 34.0.2
- Wait some time and let some cron jobs pass
Expected behavior
No errors within the nextcloud log
Actual behavior
The following error occurs with every cron job:
ServiceException
Could not get message flag options from IMAP: IMAP error reported by server.
{
"reqId": "7JqpdQP6yaPV4HuHAzYn",
"level": 3,
"time": "2026-07-24T07:45:12+00:00",
"remoteAddr": "",
"user": "--",
"app": "mail",
"method": "",
"url": "--",
"scriptName": "/var/www/html/owncloud/cron.php",
"message": "Cron mail sync failed for account 21",
"userAgent": "--",
"version": "34.0.2.1",
"occ_command": [
"/var/www/html/owncloud/cron.php"
],
"exception": {
"Exception": "OCA\\Mail\\Exception\\ServiceException",
"Message": "Could not get message flag options from IMAP: IMAP error reported by server.",
"Code": 0,
"Trace": [
{
"file": "/var/www/html/owncloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php",
"line": 504,
"function": "isPermflagsEnabled",
"class": "OCA\\Mail\\Service\\MailManager",
"type": "->"
},
{
"file": "/var/www/html/owncloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php",
"line": 269,
"function": "runPartialSync",
"class": "OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer",
"type": "->"
},
{
"file": "/var/www/html/owncloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php",
"line": 134,
"function": "sync",
"class": "OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer",
"type": "->",
"args": [
"*** sensitive parameters replaced ***"
]
},
{
"file": "/var/www/html/owncloud/apps/mail/lib/BackgroundJob/SyncJob.php",
"line": 128,
"function": "syncAccount",
"class": "OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer",
"type": "->",
"args": [
"*** sensitive parameters replaced ***"
]
},
{
"file": "/var/www/html/owncloud/lib/public/BackgroundJob/Job.php",
"line": 50,
"function": "run",
"class": "OCA\\Mail\\BackgroundJob\\SyncJob",
"type": "->"
},
{
"file": "/var/www/html/owncloud/lib/public/BackgroundJob/TimedJob.php",
"line": 86,
"function": "start",
"class": "OCP\\BackgroundJob\\Job",
"type": "->"
},
{
"file": "/var/www/html/owncloud/core/Service/CronService.php",
"line": 204,
"function": "start",
"class": "OCP\\BackgroundJob\\TimedJob",
"type": "->"
},
{
"file": "/var/www/html/owncloud/core/Service/CronService.php",
"line": 107,
"function": "runCli",
"class": "OC\\Core\\Service\\CronService",
"type": "->"
},
{
"file": "/var/www/html/owncloud/cron.php",
"line": 52,
"function": "run",
"class": "OC\\Core\\Service\\CronService",
"type": "->"
}
],
"File": "/var/www/html/owncloud/apps/mail/lib/Service/MailManager.php",
"Line": 802,
"Previous": {
"Exception": "Horde_Imap_Client_Exception_ServerResponse",
"Message": "IMAP error reported by server.",
"Code": 0,
"Trace": [
{
"file": "/var/www/html/owncloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php",
"line": 4321,
"function": "_getLine",
"class": "Horde_Imap_Client_Socket",
"type": "->"
},
{
"file": "/var/www/html/owncloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php",
"line": 4245,
"function": "_sendCmdChunk",
"class": "Horde_Imap_Client_Socket",
"type": "->"
},
{
"file": "/var/www/html/owncloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php",
"line": 1753,
"function": "_sendCmd",
"class": "Horde_Imap_Client_Socket",
"type": "->"
},
{
"file": "/var/www/html/owncloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Base.php",
"line": 1731,
"function": "_status",
"class": "Horde_Imap_Client_Socket",
"type": "->"
},
{
"file": "/var/www/html/owncloud/apps/mail/lib/Service/MailManager.php",
"line": 800,
"function": "status",
"class": "Horde_Imap_Client_Base",
"type": "->"
},
{
"file": "/var/www/html/owncloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php",
"line": 504,
"function": "isPermflagsEnabled",
"class": "OCA\\Mail\\Service\\MailManager",
"type": "->"
},
{
"file": "/var/www/html/owncloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php",
"line": 269,
"function": "runPartialSync",
"class": "OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer",
"type": "->"
},
{
"file": "/var/www/html/owncloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php",
"line": 134,
"function": "sync",
"class": "OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer",
"type": "->",
"args": [
"*** sensitive parameters replaced ***"
]
},
{
"file": "/var/www/html/owncloud/apps/mail/lib/BackgroundJob/SyncJob.php",
"line": 128,
"function": "syncAccount",
"class": "OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer",
"type": "->",
"args": [
"*** sensitive parameters replaced ***"
]
},
{
"file": "/var/www/html/owncloud/lib/public/BackgroundJob/Job.php",
"line": 50,
"function": "run",
"class": "OCA\\Mail\\BackgroundJob\\SyncJob",
"type": "->"
},
{
"file": "/var/www/html/owncloud/lib/public/BackgroundJob/TimedJob.php",
"line": 86,
"function": "start",
"class": "OCP\\BackgroundJob\\Job",
"type": "->"
},
{
"file": "/var/www/html/owncloud/core/Service/CronService.php",
"line": 204,
"function": "start",
"class": "OCP\\BackgroundJob\\TimedJob",
"type": "->"
},
{
"file": "/var/www/html/owncloud/core/Service/CronService.php",
"line": 107,
"function": "runCli",
"class": "OC\\Core\\Service\\CronService",
"type": "->"
},
{
"file": "/var/www/html/owncloud/cron.php",
"line": 52,
"function": "run",
"class": "OC\\Core\\Service\\CronService",
"type": "->"
}
],
"File": "/var/www/html/owncloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php",
"Line": 4624
},
"message": "Cron mail sync failed for account {accountId}",
"exception": "{\"class\":\"OCA\\Mail\\Exception\\ServiceException\",\"message\":\"Could not get message flag options from IMAP: IMAP error reported by server.\",\"code\":0,\"file\":\"/var/www/html/owncloud/apps/mail/lib/Service/MailManager.php:802\",\"trace\":\"#0 /var/www/html/owncloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php(504): OCA\\Mail\\Service\\MailManager->isPermflagsEnabled()\\n#1 /var/www/html/owncloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php(269): OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer->runPartialSync()\\n#2 /var/www/html/owncloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php(134): OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer->sync()\\n#3 /var/www/html/owncloud/apps/mail/lib/BackgroundJob/SyncJob.php(128): OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer->syncAccount()\\n#4 /var/www/html/owncloud/lib/public/BackgroundJob/Job.php(50): OCA\\Mail\\BackgroundJob\\SyncJob->run()\\n#5 /var/www/html/owncloud/lib/public/BackgroundJob/TimedJob.php(86): OCP\\BackgroundJob\\Job->start()\\n#6 /var/www/html/owncloud/core/Service/CronService.php(204): OCP\\BackgroundJob\\TimedJob->start()\\n#7 /var/www/html/owncloud/core/Service/CronService.php(107): OC\\Core\\Service\\CronService->runCli()\\n#8 /var/www/html/owncloud/cron.php(52): OC\\Core\\Service\\CronService->run()\\n#9 {main}\",\"previous\":{\"class\":\"Horde_Imap_Client_Exception_ServerResponse\",\"message\":\"IMAP error reported by server.\",\"code\":0,\"file\":\"/var/www/html/owncloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php:4624\",\"trace\":\"#0 /var/www/html/owncloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php(4321): Horde_Imap_Client_Socket->_getLine()\\n#1 /var/www/html/owncloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php(4245): Horde_Imap_Client_Socket->_sendCmdChunk()\\n#2 /var/www/html/owncloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php(1753): Horde_Imap_Client_Socket->_sendCmd()\\n#3 /var/www/html/owncloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Base.php(1731): Horde_Imap_Client_Socket->_status()\\n#4 /var/www/html/owncloud/apps/mail/lib/Service/MailManager.php(800): Horde_Imap_Client_Base->status()\\n#5 /var/www/html/owncloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php(504): OCA\\Mail\\Service\\MailManager->isPermflagsEnabled()\\n#6 /var/www/html/owncloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php(269): OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer->runPartialSync()\\n#7 /var/www/html/owncloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php(134): OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer->sync()\\n#8 /var/www/html/owncloud/apps/mail/lib/BackgroundJob/SyncJob.php(128): OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer->syncAccount()\\n#9 /var/www/html/owncloud/lib/public/BackgroundJob/Job.php(50): OCA\\Mail\\BackgroundJob\\SyncJob->run()\\n#10 /var/www/html/owncloud/lib/public/BackgroundJob/TimedJob.php(86): OCP\\BackgroundJob\\Job->start()\\n#11 /var/www/html/owncloud/core/Service/CronService.php(204): OCP\\BackgroundJob\\TimedJob->start()\\n#12 /var/www/html/owncloud/core/Service/CronService.php(107): OC\\Core\\Service\\CronService->runCli()\\n#13 /var/www/html/owncloud/cron.php(52): OC\\Core\\Service\\CronService->run()\\n#14 {main}\"}}",
"CustomMessage": "Cron mail sync failed for account 21"
},
"id": "6a631cda1e9b3"
}
Mail app version
5.10.9
Nextcloud version
34.0.2
Mailserver or service
iCloud
Operating system
Ubuntu Server
PHP engine version
Other
Nextcloud memory caching
No response
Web server
Apache (supported)
Database
MariaDB
Additional info
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.