Unsubscribe link not working (sometimes)

Your software
My Mautic version is: 4.4.9
My PHP version is: 8.0
My Database type and version is: mariadb 10.6

Your problem
My problem is: Sometimes the unsubscribe link fails and I get an error 500. This happens only a few times out of hundreds of emails sent, however, I’m still wondering because this could hurt our reputation as a sender. We do not want people reporting us as spammers.

These errors are showing in the log:
There’s literally nothing in the logs.

Steps I have tried to fix the problem:
Not sure how to fix this because I don’t know where else I need to look at. I’ve checked the nginx logs, mautic logs, etc but nothing shows anything about this error. Even when visiting the faulty link, this does not add anything to the logs.

In your app/config/local.php set debugging to “true”

Check file permissions and ownership of var/logs and cache, especially the prod folder.
This issue drove me crazy but every time I reset logs and file permissions it fixed the 500 error when unsubscribe link is clicked.

Thank you, I can see entries like this now:

[2023-08-21 19:23:13] mautic.DEBUG: CONTACT: 4391 set as current lead. {"hostname":"mautic-server","pid":10340}

[2023-08-21 19:23:13] mautic.DEBUG: LEAD: Tracking ID for this device is yzqs6fajob85undhbzghmej {"hostname":"mautic-server","pid":10340}

[2023-08-21 19:23:13] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\Translation\Exception\InvalidArgumentException: "Invalid "Phoenix, Arizona Area" locale." at /var/www/mautic-site/vendor/symfony/translation/Translator.php line 512 {"exception":"[object] (Symfony\\Component\\Translation\\Exception\\InvalidArgumentException(code: 0): Invalid \"Phoenix, Arizona Area\" locale. at /var/www/mautic-site/vendor/symfony/translation/Translator.php:512)


#0 /var/www/mautic-site/vendor/symfony/translation/Translator.php(166): Symfony\\Component\\Translation\\Translator->assertValidLocale()

#1 /var/www/mautic-site/app/bundles/EmailBundle/Controller/PublicController.php(170): Symfony\\Component\\Translation\\Translator->setLocale()

#2 /var/www/mautic-site/vendor/symfony/http-kernel/HttpKernel.php(158): Mautic\\EmailBundle\\Controller\\PublicController->unsubscribeAction()

#3 /var/www/mautic-site/vendor/symfony/http-kernel/HttpKernel.php(80): Symfony\\Component\\HttpKernel\\HttpKernel->handleRaw()

#4 /var/www/mautic-site/vendor/symfony/http-kernel/Kernel.php(201): Symfony\\Component\\HttpKernel\\HttpKernel->handle()

#5 /var/www/mautic-site/app/AppKernel.php(115): Symfony\\Component\\HttpKernel\\Kernel->handle()

#6 /var/www/mautic-site/app/middlewares/CORSMiddleware.php(82): AppKernel->handle()

#7 /var/www/mautic-site/app/middlewares/CatchExceptionMiddleware.php(34): Mautic\\Middleware\\CORSMiddleware->handle()

#8 /var/www/mautic-site/app/middlewares/VersionCheckMiddleware.php(58): Mautic\\Middleware\\CatchExceptionMiddleware->handle()

#9 /var/www/mautic-site/app/middlewares/TrustMiddleware.php(42): Mautic\\Middleware\\VersionCheckMiddleware->handle()

#10 /var/www/mautic-site/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Mautic\\Middleware\\TrustMiddleware->handle()

#11 /var/www/mautic-site/vendor/stack/run/src/Stack/run.php(13): Stack\\StackedHttpKernel->handle()

un()/var/www/mautic-site/index.php(24): Stack\

#13 {main}

"} {"hostname":"mautic-server","pid":10340}

But I’m honestly now sure what it actually means. However, I do know that this can be “fixed” by re-saving the contact. This contact was imported, so it could be an import error or something like that. The thing is that I have several contacts like this and it can take a while for me to re-save each and every contact.


maybe your data in this cell isnt playing nice with the preset locality data. There are preset City and States in the locality data and it appears " Arizona Area" threw the error.

The funny thing is that those fields were empty. A workaround is to re-save the contact and that “fixes” the issue. But if you have lots of contacts in a segment for example, then what I did was to add a custom field, download a csv file for that affected segment and then add a value to this new field, finally I imported the file back forcing an update in all these contacts. Just don’t forget to delete this custom field from Mautic and you’re good.

1 Like