500 Internal Server Error after trying to add a widget

Your software
My Mautic version is: 4.1.2
My PHP version is: 7.4
My Database type and version is: mySQL

Your problem
My problem is: After tried to add a widget (emails sent) I am receiving a 500 error and can not open the dashboard, then I can not access to the Mautic system after login

500 Internal Server Error

These errors are showing in the log:
[2022-03-14 23:52:05] mautic.CRITICAL: Uncaught PHP Exception Doctrine\DBAL\Exception\DriverException: “An exception occurred while executing ‘SELECT s.id, s.lead_id, s.email_address, s.is_read, s.email_id, s.date_sent, s.date_read, e.name AS email_name, COUNT(ph.id) AS link_hits, c.id AS company_id, c.companyname AS company_name, campaign.id AS campaign_id, campaign.name AS campaign_name, ll.id AS segment_id, ll.name AS segment_name FROM email_stats s LEFT JOIN emails e ON s.email_id = e.id LEFT JOIN page_hits ph ON ph.source = “email” and ph.source_id = s.email_id and ph.lead_id = s.lead_id LEFT JOIN companies_leads cl ON s.lead_id = cl.lead_id LEFT JOIN companies c ON cl.company_id = c.id LEFT JOIN campaign_events ce ON s.source = “campaign.event” and s.source_id = ce.id LEFT JOIN lead_lists ll ON s.list_id = ll.id LEFT JOIN campaigns campaign ON ce.campaign_id = campaign.id WHERE s.date_sent BETWEEN ? AND ? GROUP BY s.id ORDER BY s.id DESC LIMIT 6’ with params [“2022-02-14 00:00:00”, “2022-03-14 00:00:00”]: SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #10 of SELECT list is not in GROUP BY clause and contains nonaggregated column ‘marketingesdb.c.id’ which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by” at /home/lastanza/marketinges/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 128 {“exception”:"[object] (Doctrine\DBAL\Exception\DriverException(code: 0): An exception occurred while executing ‘SELECT s.id, s.lead_id, s.email_address, s.is_read, s.email_id, s.date_sent, s.date_read, e.name AS email_name, COUNT(ph.id) AS link_hits, c.id AS company_id, c.companyname AS company_name, campaign.id AS campaign_id, campaign.name AS campaign_name, ll.id AS segment_id, ll.name AS segment_name FROM email_stats s LEFT JOIN emails e ON s.email_id = e.id LEFT JOIN page_hits ph ON ph.source = “email” and ph.source_id = s.email_id and ph.lead_id = s.lead_id LEFT JOIN companies_leads cl ON s.lead_id = cl.lead_id LEFT JOIN companies c ON cl.company_id = c.id LEFT JOIN campaign_events ce ON s.source = “campaign.event” and s.source_id = ce.id LEFT JOIN lead_lists ll ON s.list_id = ll.id LEFT JOIN campaigns campaign ON ce.campaign_id = campaign.id WHERE s.date_sent BETWEEN ? AND ? GROUP BY s.id ORDER BY s.id DESC LIMIT 6’ with params [“2022-02-14 00:00:00”, “2022-03-14 00:00:00”]:\n\nSQLSTATE[42000]: Syntax error or access violation: 1055 Expression #10 of SELECT list is not in GROUP BY clause and contains nonaggregated column ‘marketingesdb.c.id’ which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by at /home/lastanza/marketinges/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:128, Doctrine\DBAL\Driver\PDO\Exception(code: 42000): SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #10 of SELECT list is not in GROUP BY clause and contains nonaggregated column ‘marketingesdb.c.id’ which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by at /home/lastanza/marketinges/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDO/Exception.php:18, PDOException(code: 42000): SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #10 of SELECT list is not in GROUP BY clause and contains nonaggregated column ‘marketingesdb.c.id’ which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by at /home/lastanza/marketinges/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:112)"}

Steps I have tried to fix the problem:

  • [doctrine:schema:update --force] and clear cache.
    restart database

I can access to the Mautic writing the exact url of other options but not to the dashboard

I had the same exact problem today. What I did I deleted the latest widget row “sent emails” from the “ma_widgets” table. The dashboard loaded again.