Cron mail sync failed: `getUid()` on null
Open
Nobody has claimed this yet.
0. to triage
bug
- Dominant language
- JavaScript
- Stars
- 1k
- Forks
- 348
- Avg merge
- 12h 28m
- Merged PRs (30d)
- 91
Description
Steps to reproduce
- Wait for cron to run
Expected behavior
No error
Actual behavior
Error
Mail app version
5.1.2
Nextcloud version
30.0.11
Mailserver or service
No response
Operating system
No response
PHP engine version
PHP 8.3
Nextcloud memory caching
Redis
Web server
Apache (supported)
Database
MariaDB
Additional info
{
"reqId": "WVuQI7DCyaWsM8VSqVPH",
"level": 3,
"time": "2025-06-05T06:54:04+02:00",
"remoteAddr": "",
"user": "--",
"app": "mail",
"method": "",
"url": "--",
"message": "Cron mail sync failed for account 35",
"userAgent": "--",
"version": "30.0.11.1",
"exception": {
"Exception": "OCA\\Mail\\Exception\\ServiceException",
"Message": "Sync failed for 35:INBOX: Call to a member function getUid() on null",
"Code": 0,
"Trace": [
{
"file": "/var/www/nextcloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php",
"line": 133,
"function": "sync",
"class": "OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer",
"type": "->",
"args": [
"*** sensitive parameters replaced ***"
]
},
{
"file": "/var/www/nextcloud/apps/mail/lib/BackgroundJob/SyncJob.php",
"line": 93,
"function": "syncAccount",
"class": "OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer",
"type": "->",
"args": [
"*** sensitive parameters replaced ***"
]
},
{
"file": "/var/www/nextcloud/lib/public/BackgroundJob/Job.php",
"line": 61,
"function": "run",
"class": "OCA\\Mail\\BackgroundJob\\SyncJob",
"type": "->"
},
{
"file": "/var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php",
"line": 88,
"function": "start",
"class": "OCP\\BackgroundJob\\Job",
"type": "->"
},
{
"file": "/var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php",
"line": 75,
"function": "start",
"class": "OCP\\BackgroundJob\\TimedJob",
"type": "->"
},
{
"file": "/var/www/nextcloud/cron.php",
"line": 162,
"function": "execute",
"class": "OCP\\BackgroundJob\\TimedJob",
"type": "->"
}
],
"File": "/var/www/nextcloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php",
"Line": 282,
"Previous": {
"Exception": "Error",
"Message": "Call to a member function getUid() on null",
"Code": 0,
"Trace": [
{
"file": "/var/www/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php",
"line": 1236,
"function": "_sendCmd",
"class": "Horde_Imap_Client_Socket",
"type": "->"
},
{
"file": "/var/www/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Base.php",
"line": 1066,
"function": "_openMailbox",
"class": "Horde_Imap_Client_Socket",
"type": "->"
},
{
"file": "/var/www/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Base.php",
"line": 1694,
"function": "openMailbox",
"class": "Horde_Imap_Client_Base",
"type": "->"
},
{
"file": "/var/www/nextcloud/apps/mail/lib/Service/MailManager.php",
"line": 802,
"function": "status",
"class": "Horde_Imap_Client_Base",
"type": "->"
},
{
"file": "/var/www/nextcloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php",
"line": 479,
"function": "isPermflagsEnabled",
"class": "OCA\\Mail\\Service\\MailManager",
"type": "->"
},
{
"file": "/var/www/nextcloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php",
"line": 263,
"function": "runPartialSync",
"class": "OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer",
"type": "->"
},
{
"file": "/var/www/nextcloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php",
"line": 133,
"function": "sync",
"class": "OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer",
"type": "->",
"args": [
"*** sensitive parameters replaced ***"
]
},
{
"file": "/var/www/nextcloud/apps/mail/lib/BackgroundJob/SyncJob.php",
"line": 93,
"function": "syncAccount",
"class": "OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer",
"type": "->",
"args": [
"*** sensitive parameters replaced ***"
]
},
{
"file": "/var/www/nextcloud/lib/public/BackgroundJob/Job.php",
"line": 61,
"function": "run",
"class": "OCA\\Mail\\BackgroundJob\\SyncJob",
"type": "->"
},
{
"file": "/var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php",
"line": 88,
"function": "start",
"class": "OCP\\BackgroundJob\\Job",
"type": "->"
},
{
"file": "/var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php",
"line": 75,
"function": "start",
"class": "OCP\\BackgroundJob\\TimedJob",
"type": "->"
},
{
"file": "/var/www/nextcloud/cron.php",
"line": 162,
"function": "execute",
"class": "OCP\\BackgroundJob\\TimedJob",
"type": "->"
}
],
"File": "/var/www/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php",
"Line": 4248
},
"message": "Cron mail sync failed for account {accountId}",
"exception": [],
"CustomMessage": "Cron mail sync failed for account 35"
},
"id": "6841435c6d602"
}
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.
Research direction
Start with apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php, especially lines 133, 263, 282, and 479, and follow the stack trace through MailManager.php and BackgroundJob/SyncJob.php. Reproduce the cron sync failure and trace why getUid() is called on null. Done means the affected account can complete cron mail synchronization without this error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100