Mautic Community Forums

Mautic crashed: internal server error after editing dashboard "Best email read hours" widget

Your software
My Mautic version is: 4.0.2
My PHP version is: 7.4.3
My Database type and version is:
DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci
mysql Ver 15.1 Distrib 10.3.31-MariaDB, for debian-linux-gnu (aarch64) using readline 5.2

Your problem
My problem is:
Mautic has crashed after editing a simple “Best email read hours” widget.
Even clearing cache doesn’t bring it to life.

These errors are showing in the log:

[2021-11-24 11:58:51] mautic.ERROR: Invalid clickthrough value: Yjo4OntmOjk6ImZiaGVkZiI7Yjo1Ont2OjM7Zjo0NzoiZGJ6Y2J2dGEuZmlmYWciO3Y6NDt2Ojc2MTt9Zjo4OiJmemJ2eSI7djo4MTtmOjc6ImZnYmciO2Y6NTU6Ijk0MmVlMjhkOWNiOWQ2MjU5NzMzMzgiO2Y6NzoieWZiZSI7Zjo3OiI5NDc2IjtmOjA6ImR1YmFhZnkiO2I6NDp7Zjo4OiJmemJ2eSI7djo4MTt9fQ== {"exception":"[object] (Mautic\\CoreBundle\\Exception\\InvalidDecodedStringException(code: 0): The string b:8:{f:9:\"fbhedf\";b:5:{v:3;f:47:\"dbzcbvta.fifag\";v:4;v:761;}f:8:\"fzbvy\";v:81;f:7:\"fgbg\";f:55:\"942ee28d9cb9d625973338\";f:7:\"yfbe\";f:7:\"9476\";f:0:\"dubaafy\";b:4:{f:8:\"fzbvy\";v:81;}} is not a serialized array at /var/www/mautic/app/bundles/CoreBundle/Helper/ClickthroughHelper.php:46)"} []
[2021-11-24 11:58:51] mautic.ERROR: Invalid clickthrough value: Yjo4OntmOjk6ImZiaGVkZiI7Yjo1Ont2OjM7Zjo0NzoiZGJ6Y2J2dGEuZmlmYWciO3Y6NDt2Ojc2MTt9Zjo4OiJmemJ2eSI7djo4MTtmOjc6ImZnYmciO2Y6NTU6Ijk0MmVlMjhkOWNiOWQ2MjU5NzMzMzgiO2Y6NzoieWZiZSI7Zjo3OiI5NDc2IjtmOjA6ImR1YmFhZnkiO2I6NDp7Zjo4OiJmemJ2eSI7djo4MTt9fQ== {"exception":"[object] (Mautic\\CoreBundle\\Exception\\InvalidDecodedStringException(code: 0): The string b:8:{f:9:\"fbhedf\";b:5:{v:3;f:47:\"dbzcbvta.fifag\";v:4;v:761;}f:8:\"fzbvy\";v:81;f:7:\"fgbg\";f:55:\"942ee28d9cb9d625973338\";f:7:\"yfbe\";f:7:\"9476\";f:0:\"dubaafy\";b:4:{f:8:\"fzbvy\";v:81;}} is not a serialized array at /var/www/mautic/app/bundles/CoreBundle/Helper/ClickthroughHelper.php:46)"} []
[2021-11-24 22:11:24] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalThrowableError: "Call to a member function getCount() on int" at /var/www/mautic/app/bundles/StatsBundle/Aggregate/Calculator.php line 187 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Call to a member function getCount() on int at /var/www/mautic/app/bundles/StatsBundle/Aggregate/Calculator.php:187)"} []
[2021-11-24 22:22:37] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalThrowableError: "Call to a member function createQueryBuilder() on null" at /var/www/mautic/app/bundles/EmailBundle/Stats/Helper/FilterTrait.php line 79 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Call to a member function createQueryBuilder() on null at /var/www/mautic/app/bundles/EmailBundle/Stats/Helper/FilterTrait.php:79)"} []
[2021-11-24 22:22:49] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalThrowableError: "Call to a member function createQueryBuilder() on null" at /var/www/mautic/app/bundles/EmailBundle/Stats/Helper/FilterTrait.php line 79 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Call to a member function createQueryBuilder() on null at /var/www/mautic/app/bundles/EmailBundle/Stats/Helper/FilterTrait.php:79)"} []
[2021-11-24 22:24:55] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalThrowableError: "Call to a member function createQueryBuilder() on null" at /var/www/mautic/app/bundles/EmailBundle/Stats/Helper/FilterTrait.php line 79 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Call to a member function createQueryBuilder() on null at /var/www/mautic/app/bundles/EmailBundle/Stats/Helper/FilterTrait.php:79)"} []
[2021-11-24 22:25:01] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalThrowableError: "Call to a member function createQueryBuilder() on null" at /var/www/mautic/app/bundles/EmailBundle/Stats/Helper/FilterTrait.php line 79 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Call to a member function createQueryBuilder() on null at /var/www/mautic/app/bundles/EmailBundle/Stats/Helper/FilterTrait.php:79)"} []
[2021-11-24 22:25:05] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalThrowableError: "Call to a member function createQueryBuilder() on null" at /var/www/mautic/app/bundles/EmailBundle/Stats/Helper/FilterTrait.php line 79 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Call to a member function createQueryBuilder() on null at /var/www/mautic/app/bundles/EmailBundle/Stats/Helper/FilterTrait.php:79)"} []
[2021-11-24 22:25:16] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalThrowableError: "Call to a member function createQueryBuilder() on null" at /var/www/mautic/app/bundles/EmailBundle/Stats/Helper/FilterTrait.php line 79 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Call to a member function createQueryBuilder() on null at /var/www/mautic/app/bundles/EmailBundle/Stats/Helper/FilterTrait.php:79)"} []
[2021-11-24 22:27:05] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\Filesystem\Exception\IOException: "Cannot rename "/tmp/UrlMatcher.phpWAmy7Y" to "/var/www/mautic/var/cache/prod/UrlMatcher.php"." at /var/www/mautic/vendor/symfony/filesystem/Filesystem.php line 290 {"exception":"[object] (Symfony\\Component\\Filesystem\\Exception\\IOException(code: 0): Cannot rename \"/tmp/UrlMatcher.phpWAmy7Y\" to \"/var/www/mautic/var/cache/prod/UrlMatcher.php\". at /var/www/mautic/vendor/symfony/filesystem/Filesystem.php:290)"} []
[2021-11-24 22:27:05] mautic.ERROR: Symfony\Component\Filesystem\Exception\IOException: Cannot rename "/tmp/UrlGenerator.phpNqWgTW" to "/var/www/mautic/var/cache/prod/UrlGenerator.php". - in file /var/www/mautic/vendor/symfony/filesystem/Filesystem.php - at line 290 [] []
[2021-11-24 22:27:12] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\Filesystem\Exception\IOException: "Cannot rename "/tmp/UrlMatcher.phpkdr5Rq" to "/var/www/mautic/var/cache/prod/UrlMatcher.php"." at /var/www/mautic/vendor/symfony/filesystem/Filesystem.php line 290 {"exception":"[object] (Symfony\\Component\\Filesystem\\Exception\\IOException(code: 0): Cannot rename \"/tmp/UrlMatcher.phpkdr5Rq\" to \"/var/www/mautic/var/cache/prod/UrlMatcher.php\". at /var/www/mautic/vendor/symfony/filesystem/Filesystem.php:290)"} []
[2021-11-24 22:27:12] mautic.ERROR: Symfony\Component\Filesystem\Exception\IOException: Cannot rename "/tmp/UrlGenerator.phpNTcWls" to "/var/www/mautic/var/cache/prod/UrlGenerator.php". - in file /var/www/mautic/vendor/symfony/filesystem/Filesystem.php - at line 290 [] []
[2021-11-24 22:27:15] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\Filesystem\Exception\IOException: "Cannot rename "/tmp/UrlMatcher.phpO00xvV" to "/var/www/mautic/var/cache/prod/UrlMatcher.php"." at /var/www/mautic/vendor/symfony/filesystem/Filesystem.php line 290 {"exception":"[object] (Symfony\\Component\\Filesystem\\Exception\\IOException(code: 0): Cannot rename \"/tmp/UrlMatcher.phpO00xvV\" to \"/var/www/mautic/var/cache/prod/UrlMatcher.php\". at /var/www/mautic/vendor/symfony/filesystem/Filesystem.php:290)"} []
[2021-11-24 22:27:15] mautic.ERROR: Symfony\Component\Filesystem\Exception\IOException: Cannot rename "/tmp/UrlGenerator.phpWKVziT" to "/var/www/mautic/var/cache/prod/UrlGenerator.php". - in file /var/www/mautic/vendor/symfony/filesystem/Filesystem.php - at line 290 [] []
[2021-11-24 22:27:18] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\Filesystem\Exception\IOException: "Cannot rename "/tmp/UrlMatcher.phpAVqQ9E" to "/var/www/mautic/var/cache/prod/UrlMatcher.php"." at /var/www/mautic/vendor/symfony/filesystem/Filesystem.php line 290 {"exception":"[object] (Symfony\\Component\\Filesystem\\Exception\\IOException(code: 0): Cannot rename \"/tmp/UrlMatcher.phpAVqQ9E\" to \"/var/www/mautic/var/cache/prod/UrlMatcher.php\". at /var/www/mautic/vendor/symfony/filesystem/Filesystem.php:290)"} []
[2021-11-24 22:27:18] mautic.ERROR: Symfony\Component\Filesystem\Exception\IOException: Cannot rename "/tmp/UrlGenerator.phpZyfd2D" to "/var/www/mautic/var/cache/prod/UrlGenerator.php". - in file /var/www/mautic/vendor/symfony/filesystem/Filesystem.php - at line 290 [] []
[2021-11-24 22:27:20] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\Filesystem\Exception\IOException: "Cannot rename "/tmp/UrlMatcher.phpNdaFqe" to "/var/www/mautic/var/cache/prod/UrlMatcher.php"." at /var/www/mautic/vendor/symfony/filesystem/Filesystem.php line 290 {"exception":"[object] (Symfony\\Component\\Filesystem\\Exception\\IOException(code: 0): Cannot rename \"/tmp/UrlMatcher.phpNdaFqe\" to \"/var/www/mautic/var/cache/prod/UrlMatcher.php\". at /var/www/mautic/vendor/symfony/filesystem/Filesystem.php:290)"} []
[2021-11-24 22:27:20] mautic.ERROR: Symfony\Component\Filesystem\Exception\IOException: Cannot rename "/tmp/UrlGenerator.phpYa2kzh" to "/var/www/mautic/var/cache/prod/UrlGenerator.php". - in file /var/www/mautic/vendor/symfony/filesystem/Filesystem.php - at line 290 [] []
[2021-11-24 22:28:01] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\Filesystem\Exception\IOException: "Cannot rename "/tmp/UrlMatcher.php93cHEe" to "/var/www/mautic/var/cache/prod/UrlMatcher.php"." at /var/www/mautic/vendor/symfony/filesystem/Filesystem.php line 290 {"exception":"[object] (Symfony\\Component\\Filesystem\\Exception\\IOException(code: 0): Cannot rename \"/tmp/UrlMatcher.php93cHEe\" to \"/var/www/mautic/var/cache/prod/UrlMatcher.php\". at /var/www/mautic/vendor/symfony/filesystem/Filesystem.php:290)"} []
[2021-11-24 22:28:01] mautic.ERROR: Symfony\Component\Filesystem\Exception\IOException: Cannot rename "/tmp/UrlGenerator.phpo1p2If" to "/var/www/mautic/var/cache/prod/UrlGenerator.php". - in file /var/www/mautic/vendor/symfony/filesystem/Filesystem.php - at line 290 [] []

Steps I have tried to fix the problem:
Cleared mautic cache

Relevant bug report: Mautic crashed: internal server error after editing dashboard “Best email read hours” widget · Issue #10640 · mautic/mautic (github.com)

Update: fixed cache permission issues. But still getting 500 internal server error.

I think the problem is here:

[2021-11-24 22:11:24] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalThrowableError: "Call to a member function getCount() on int" at /var/www/mautic/app/bundles/StatsBundle/Aggregate/Calculator.php line 187 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Call to a member function getCount() on int at /var/www/mautic/app/bundles/StatsBundle/Aggregate/Calculator.php:187)"} []

or here:

[2021-11-24 22:22:37] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalThrowableError: "Call to a member function createQueryBuilder() on null" at /var/www/mautic/app/bundles/EmailBundle/Stats/Helper/FilterTrait.php line 79 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Call to a member function createQueryBuilder() on null at /var/www/mautic/app/bundles/EmailBundle/Stats/Helper/FilterTrait.php:79)"} []

How do I get mautic working again?

update: just checked, all other mautic urls working perfectly, except for dashboard.

Maybe if I disabled “Best email read hours” widget from the dashboard, I could get Mautic working again, but I don’t know how to disable that widget.

UPDATE: FIXED

Ran following commands on my machine:

1 .Fist login as root user in your mysql.

sudo mysql -u root
  1. Replace mautic-database-name with your own mautic database name and run this in mysql interface:
USE mautic-database-name;
  1. Print widgets table:
SELECT * FROM widgets;
  1. find out the ID of the widget that is broken and update its params, in my case the ID of the widget was 7, so:
UPDATE widgets SET params = "a:0:{}" WHERE id = 7;

that’s it!

cheers!