Mail update failed

Nextcloud version: from 20.0.10 to 20.0.14
Operating system and version: Debian 10
Apache or nginx version: Apache2
PHP version: 7.3.31-1

Performed the web update but it failed. Performed the CLI update which seemed to succeed without error but upon taking out of maintenance mode, webui prompted to upgrade the mail app. After a couple of subsequent attempts, the occ upgrade started producing the following error:

An unhandled exception has been thrown:
ArgumentCountError: Too few arguments to function OCA\Mail\Migration\ProvisionAccounts::__construct(), 0 passed in /var/www/nextcloud/lib/private/Repair.php on line 129 and exactly 1 expected in /var/www/nextcloud/apps/mail/lib/Migration/ProvisionAccounts.php:37
Stack trace:
#0 /var/www/nextcloud/lib/private/Repair.php(129): OCA\Mail\Migration\ProvisionAccounts->__construct()
#1 /var/www/nextcloud/lib/private/legacy/OC_App.php(1053): OC\Repair->addStep('OCA\\Mail\\Migrat...')
#2 /var/www/nextcloud/lib/private/legacy/OC_App.php(997): OC_App::executeRepairSteps('mail', Array)
#3 /var/www/nextcloud/lib/private/Updater.php(386): OC_App::updateApp('mail')
#4 /var/www/nextcloud/lib/private/Updater.php(260): OC\Updater->doAppUpgrade()
#5 /var/www/nextcloud/lib/private/Updater.php(132): OC\Updater->doUpgrade('20.0.14.2', '20.0.10.1')
#6 /var/www/nextcloud/core/Command/Upgrade.php(255): OC\Updater->upgrade()
#7 /var/www/nextcloud/3rdparty/symfony/console/Command/Command.php(255): OC\Core\Command\Upgrade->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 /var/www/nextcloud/3rdparty/symfony/console/Application.php(1000): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 /var/www/nextcloud/3rdparty/symfony/console/Application.php(271): Symfony\Component\Console\Application->doRunCommand(Object(OC\Core\Command\Upgrade), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 /var/www/nextcloud/3rdparty/symfony/console/Application.php(147): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 /var/www/nextcloud/lib/private/Console/Application.php(215): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 /var/www/nextcloud/console.php(100): OC\Console\Application->run()
#13 /var/www/nextcloud/occ(11): require_once('/var/www/nextcl...')
#14 {main}

I was able to manually disable the mail app and disable maintenance mode and it seems to be working. I don’t actually use the mail app but would prefer not to leave it broken in case I do in the future. Right now the mail version is 1.11.0 and produces an error when enabled. It almost seems a bit like: Cannot update from v20.0.7.1 · Issue #5741 · nextcloud/mail · GitHub

Tailing the log file when enabling mail produces (sorry, i’m not sure how to format better):

{"reqId":"TdDtNTsT2RDBazf4mqMO","level":3,"time":"2021-11-29T20:33:49+00:00","remoteAddr":"172.23.1.31","user":"admin","app":"index","method":"POST","url":"/index.php/settings/apps/enable","message":{"Exception":"Exception","Message":"Too few arguments to function OCA\\Mail\\Migration\\ProvisionAccounts::__construct(), 0 passed in /var/www/nextcloud/lib/private/Repair.php on line 129 and exactly 1 expected","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":152,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Settings\\Controller\\AppSettingsController"},"enableApps"]},{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":309,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Settings\\Controller\\AppSettingsController","enableApps",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"_route":"settings.AppSettings.enableApps"}]},{"file":"/var/www/nextcloud/lib/base.php","line":1008,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/settings/apps/enable"]},{"file":"/var/www/nextcloud/index.php","line":37,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","Line":110,"Previous":{"Exception":"ArgumentCountError","Message":"Too few arguments to function OCA\\Mail\\Migration\\ProvisionAccounts::__construct(), 0 passed in /var/www/nextcloud/lib/private/Repair.php on line 129 and exactly 1 expected","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/private/Repair.php","line":129,"function":"__construct","class":"OCA\\Mail\\Migration\\ProvisionAccounts","type":"->","args":[]},{"file":"/var/www/nextcloud/lib/private/legacy/OC_App.php","line":1053,"function":"addStep","class":"OC\\Repair","type":"->","args":["OCA\\Mail\\Migration\\ProvisionAccounts"]},{"file":"/var/www/nextcloud/lib/private/Installer.php","line":160,"function":"executeRepairSteps","class":"OC_App","type":"::","args":["mail",["OCA\\Mail\\Migration\\AddMissingDefaultTags","OCA\\Mail\\Migration\\AddMissingMessageIds","OCA\\Mail\\Migration\\FixCollectedAddresses","OCA\\Mail\\Migration\\FixBackgroundJobs","OCA\\Mail\\Migration\\MakeItineraryExtractorExecutable","OCA\\Mail\\Migration\\ProvisionAccounts"]]},{"file":"/var/www/nextcloud/apps/settings/lib/Controller/AppSettingsController.php","line":453,"function":"installApp","class":"OC\\Installer","type":"->","args":["mail"]},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":169,"function":"enableApps","class":"OCA\\Settings\\Controller\\AppSettingsController","type":"->","args":[["mail"],[]]},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":100,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Settings\\Controller\\AppSettingsController"},"enableApps"]},{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":152,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Settings\\Controller\\AppSettingsController"},"enableApps"]},{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":309,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Settings\\Controller\\AppSettingsController","enableApps",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"_route":"settings.AppSettings.enableApps"}]},{"file":"/var/www/nextcloud/lib/base.php","line":1008,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/settings/apps/enable"]},{"file":"/var/www/nextcloud/index.php","line":37,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/nextcloud/apps/mail/lib/Migration/ProvisionAccounts.php","Line":37},"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:94.0) Gecko/20100101 Firefox/94.0","version":"20.0.14.2"}

Not urgent since I’m currently functional but I would like to fix it if possible.

I realized there was a remove option for the Mail app. I removed mail and redownloaded/reinstalled it but still I cannot enable it due to the aforementioned error(s). Am I missing something obvious? Should I post a bug to GIT for this? Are there any additional logs or details that would be necessary or helpful?

Hi, I did encounter the same error with Nextcloud v21.x
Disabling and re-enabling the mail app didn’t fix it …

I did upgrade Nextcloud to v22 afterwards and could reenable the mail app w/o errors.
So maybe mail v1.11.0 is incompatible with nextcloud <22?

cc @ChristophWurst Just encountered this as well.

Is this already fixed in core?

Just use the latest release.

2 Likes