Mautic Community Forums

CRITICAL: Uncaught PHP Exception. Trying to send email in 4.0.2

Your software
My PHP version is : 7.4.26
My MariaDB version is: 10.3.31-MariaDB-0ubuntu0.20.04.1

These errors are showing in the Mautic log :
mautic.NOTICE: Doctrine\DBAL\Exception\DriverException: An exception occurred while executing ‘INSERT INTO email_stats
(email_address, date_sent, is_read, is_failed, viewed_in_browser, date_read, tracking_hash, retry_count, source, source_id, tokens, open_count, last_opened, open_details, email_id, lead_id, list_id, ip_id, copy_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)’ with params [MY PARAMETERS]:
SQLSTATE[HY000]: General error: 1467 Failed to read auto-increment value from storage engine (uncaught exception) at /var/www/html/mautic4/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 128 while running console command mautic:broadcasts:send

mautic.CRITICAL: Uncaught PHP Exception Doctrine\DBAL\Exception\DriverException: “An exception occurred while executing ‘INSERT INTO email_stats (email_address, date_sent, is_read, is_failed, viewed_in_browser, date_read, tracking_hash, retry_count, source, source_id, tokens, open_count, last_opened, open_details, email_id, lead_id, list_id, ip_id, copy_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)’ with params [MY PARAMETERS]:
SQLSTATE[HY000]: General error: 1467 Failed to read auto-increment value from storage engine” at /var/www/html/mautic4/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 128 {“exception”:"[object] (Doctrine\DBAL\Exception\DriverException(code: 0): An exception occurred while executing ‘INSERT INTO email_stats (email_address, date_sent, is_read, is_failed, viewed_in_browser, date_read, tracking_hash, retry_count, source, source_id, tokens, open_count, last_opened, open_details, email_id, lead_id, list_id, ip_id, copy_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)’ with params [MY PARAMETERS]:
\n\n
SQLSTATE[HY000]: General error: 1467 Failed to read auto-increment value from storage engine at /var/www/html/mautic4/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:128, Doctrine\DBAL\Driver\PDO\Exception(code: HY000):
SQLSTATE[HY000]: General error: 1467 Failed to read auto-increment value from storage engine at /var/www/html/mautic4/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDO/Exception.php:18, PDOException(code: HY000):
SQLSTATE[HY000]: General error: 1467 Failed to read auto-increment value from storage engine at /var/www/html/mautic4/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:112)"}

Your problem
My problem is :
When I send an email as a segment email, I get the error message " Uh oh! I think I broke it…"

The issue could be related to that did run a package update.
sudo apt get update
sudo apt get upgrade

Did see a notification about FPM, and I did check the status of FPM, it says enabled.
FYI, the active Server API according to the PHP Status is Apache 2.0 Handler.
The status check show that FPM is active.
Is FPM optional?

See notes from apt upgrade:

NOTICE: Not enabling PHP 7.4 FPM by default.
NOTICE: To enable PHP 7.4 FPM in Apache2 do:
NOTICE: a2enmod proxy_fcgi setenvif
NOTICE: a2enconf php7.4-fpm

Steps I have tried to fix the problem :
I made sure the permissions were set correctly

sudo find . -type f -not -perm 644 -exec chmod 644 {} +
sudo find . -type d -not -perm 644 -exec chmod 755 {} +
sudo chmod -R g+w var/cache/ var/logs/ app/config/
sudo chmod -R g+w media/files/ media/images/ translations/

I made sure ownership was set correctly

sudo chown -R www-data:www-data . 

I cleared the cache

sudo rm -rf var/cache/*

Update:
Suddenly it did manage to send an email on 1 of 2 identical installations.
But on the one that I did manage to send an email on, the log now started showing a lot of click errors like this one:

mautic.ERROR: Invalid clickthrough value:
Yjo4OntmOjk6ImZiaGVkZiI7Yjo1Ont2OjM7Zjo4OiJmemJ2eSI7djo0O3Y6Nzc7fWY6ODoiZnpidnkiO3Y6Nzc7Zjo3OiJmZ2JnIjtmOjU1OiI5NDJmN2E0NDk3MzIwNjMyNjEzNDM1IjtmOjc6InlmYmUiO2Y6NToiNTMiO2Y6MDoiZHViYWFmeSI7Yjo0OntmOjg6ImZ6YnZ5Ijt2Ojc3O319 {“exception”:"[object] (Mautic\CoreBundle\Exception\InvalidDecodedStringException(code: 0): The string b:8:{f:9:“fbhedf”;b:5:{v:3;f:8:“fzbvy”;v:4;v:77;}f:8:“fzbvy”;v:77;f:7:“fgbg”;f:55:“942f7a4497320632613435”;f:7:“yfbe”;f:5:“53”;f:0:“dubaafy”;b:4:{f:8:“fzbvy”;v:77;}} is not a serialized array at /var/www/html/mautic4/app/bundles/CoreBundle/Helper/ClickthroughHelper.php:46)"}