Uncaught PHP Exception FatalThrowableError Call to a member function getCount()

Your software
My Mautic version is: 4.0.2
My PHP version is:
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies

My Database type and version is:
mysql Ver 8.0.27-0ubuntu0.20.04.1 for Linux on x86_64

Your problem
My problem is:
When i off CORS in settings and back on it i see Error 500 on dashboard. But i can enter in settings or reports or /campaigns… Bugs only with dashboard.
after enabling and disabling CORS, I still tried to enter the isits published Pages report and I was able to do it. did not wait for the download and switched to the dashboard. The 500 error may have been caused by a report. I still cannot enter it

These errors are showing in the log:
mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalThrowableError: “Call to a member function getCount() on int” at /home/master/m.everest-dom.com/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 ./app/bundles/StatsBundle/Aggregate/Calculator.php:187)"}

Steps I have tried to fix the problem:
php bin/console mautic:cache:clear
rm -rf app/cache/*
but no resolve :frowning:

may be this

resolve it bug?

I had a similar problem. Everything was working except for dashboard.
You may need to reset your desktop widgets params from the database one by one and see which widget is causing this problem.

see this post: Mautic crashed: internal server error after editing dashboard “Best email read hours” widget - Support - Mautic Community Forums

Here’s how I fixed that:

SSH into your server.

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;

Repeat step 4 for your all widgets one be one, starting for the widget you suspect is causing problems.

You can also do all this from phpmyadmin if you have that installed.

Thanks