Landing page throws "500 Internal Server Error" when not logged in after Mautic Upgrade

Your software
My Mautic version is: 3.3.2
My PHP version is: 7.3
My Database type and version is: 8.0.13

Your problem
My problem is:

I made an upgrade from Mautic v. 2.x to 3.3.8 via the webinterface with already existing and published landing-page. After that I tried to visit my landing page and it is only loaded and displayed correctly when I am logged in in Mautic.
When I am logged out of Mautic and load the landing page (that is published) I get “500 Internal Server Error”.

These errors are showing in the log:

[2021-04-21 07:03:53] mautic.CRITICAL: Uncaught PHP Exception Doctrine\DBAL\Exception\UniqueConstraintViolationException: "An exception occurred while executing 'INSERT INTO lead_devices (date_added, client_info, device, device_os_name, device_os_shortname, device_os_version, device_os_platform, device_brand, device_model, tracking_id, lead_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)' with params ["2021-04-21 07:03:53", "a:6:{s:4:\"type\";s:7:\"browser\";s:4:\"name\";s:6:\"Chrome\";s:10:\"short_name\";s:2:\"CH\";s:7:\"version\";s:4:\"31.0\";s:6:\"engine\";s:5:\"Blink\";s:14:\"engine_version\";s:0:\"\";}", "desktop", "Windows", "WIN", "7", "x64", "", "", "b9998uz66tmdcox5416oanq", "816"]:  SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0' for key 'PRIMARY'" at /home/www/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 55 {"exception":"[object] (Doctrine\\DBAL\\Exception\\UniqueConstraintViolationException(code: 0): An exception occurred while executing 'INSERT INTO lead_devices (date_added, client_info, device, device_os_name, device_os_shortname, device_os_version, device_os_platform, device_brand, device_model, tracking_id, lead_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)' with params [\"2021-04-21 07:03:53\", \"a:6:{s:4:\\\"type\\\";s:7:\\\"browser\\\";s:4:\\\"name\\\";s:6:\\\"Chrome\\\";s:10:\\\"short_name\\\";s:2:\\\"CH\\\";s:7:\\\"version\\\";s:4:\\\"31.0\\\";s:6:\\\"engine\\\";s:5:\\\"Blink\\\";s:14:\\\"engine_version\\\";s:0:\\\"\\\";}\", \"desktop\", \"Windows\", \"WIN\", \"7\", \"x64\", \"\", \"\", \"b9998uz66tmdcox5416oanq\", \"816\"]:\n\nSQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0' for key 'PRIMARY' at /home/www/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:55, Doctrine\\DBAL\\Driver\\PDOException(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0' for key 'PRIMARY' at /home/www/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:123, PDOException(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0' for key 'PRIMARY' at /home/www/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:121)"} []
[2021-04-21 07:03:55] mautic.CRITICAL: Uncaught PHP Exception Doctrine\DBAL\Exception\UniqueConstraintViolationException: "An exception occurred while executing 'INSERT INTO lead_devices (date_added, client_info, device, device_os_name, device_os_shortname, device_os_version, device_os_platform, device_brand, device_model, tracking_id, lead_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)' with params ["2021-04-21 07:03:55", "a:6:{s:4:\"type\";s:7:\"browser\";s:4:\"name\";s:6:\"Chrome\";s:10:\"short_name\";s:2:\"CH\";s:7:\"version\";s:4:\"31.0\";s:6:\"engine\";s:5:\"Blink\";s:14:\"engine_version\";s:0:\"\";}", "desktop", "Windows", "WIN", "7", "x64", "", "", "db9kztal3m05eztla3i3vnm", "817"]:  SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0' for key 'PRIMARY'" at /home/www/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 55 {"exception":"[object] (Doctrine\\DBAL\\Exception\\UniqueConstraintViolationException(code: 0): An exception occurred while executing 'INSERT INTO lead_devices (date_added, client_info, device, device_os_name, device_os_shortname, device_os_version, device_os_platform, device_brand, device_model, tracking_id, lead_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)' with params [\"2021-04-21 07:03:55\", \"a:6:{s:4:\\\"type\\\";s:7:\\\"browser\\\";s:4:\\\"name\\\";s:6:\\\"Chrome\\\";s:10:\\\"short_name\\\";s:2:\\\"CH\\\";s:7:\\\"version\\\";s:4:\\\"31.0\\\";s:6:\\\"engine\\\";s:5:\\\"Blink\\\";s:14:\\\"engine_version\\\";s:0:\\\"\\\";}\", \"desktop\", \"Windows\", \"WIN\", \"7\", \"x64\", \"\", \"\", \"db9kztal3m05eztla3i3vnm\", \"817\"]:\n\nSQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0' for key 'PRIMARY' at /home/www/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:55, Doctrine\\DBAL\\Driver\\PDOException(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0' for key 'PRIMARY' at /home/www/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:123, PDOException(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0' for key 'PRIMARY' at /home/www/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:121)"} []
[2021-04-21 07:03:57] mautic.CRITICAL: Uncaught PHP Exception Doctrine\DBAL\Exception\UniqueConstraintViolationException: "An exception occurred while executing 'INSERT INTO lead_devices (date_added, client_info, device, device_os_name, device_os_shortname, device_os_version, device_os_platform, device_brand, device_model, tracking_id, lead_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)' with params ["2021-04-21 07:03:57", "a:6:{s:4:\"type\";s:7:\"browser\";s:4:\"name\";s:6:\"Chrome\";s:10:\"short_name\";s:2:\"CH\";s:7:\"version\";s:4:\"31.0\";s:6:\"engine\";s:5:\"Blink\";s:14:\"engine_version\";s:0:\"\";}", "desktop", "Windows", "WIN", "7", "x64", "", "", "go6ep5edq8h2rs2lzoo9hjg", "818"]:  SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0' for key 'PRIMARY'" at /home/www/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 55 {"exception":"[object] (Doctrine\\DBAL\\Exception\\UniqueConstraintViolationException(code: 0): An exception occurred while executing 'INSERT INTO lead_devices (date_added, client_info, device, device_os_name, device_os_shortname, device_os_version, device_os_platform, device_brand, device_model, tracking_id, lead_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)' with params [\"2021-04-21 07:03:57\", \"a:6:{s:4:\\\"type\\\";s:7:\\\"browser\\\";s:4:\\\"name\\\";s:6:\\\"Chrome\\\";s:10:\\\"short_name\\\";s:2:\\\"CH\\\";s:7:\\\"version\\\";s:4:\\\"31.0\\\";s:6:\\\"engine\\\";s:5:\\\"Blink\\\";s:14:\\\"engine_version\\\";s:0:\\\"\\\";}\", \"desktop\", \"Windows\", \"WIN\", \"7\", \"x64\", \"\", \"\", \"go6ep5edq8h2rs2lzoo9hjg\", \"818\"]:\n\nSQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0' for key 'PRIMARY' at /home/www/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:55, Doctrine\\DBAL\\Driver\\PDOException(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0' for key 'PRIMARY' at /home/www/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:123, PDOException(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0' for key 'PRIMARY' at /home/www/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:121)"} []
[2021-04-21 09:23:49] mautic.CRITICAL: Uncaught PHP Exception Doctrine\DBAL\Exception\UniqueConstraintViolationException: "An exception occurred while executing 'INSERT INTO lead_devices (date_added, client_info, device, device_os_name, device_os_shortname, device_os_version, device_os_platform, device_brand, device_model, tracking_id, lead_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)' with params ["2021-04-21 09:23:49", "a:6:{s:4:\"type\";s:7:\"browser\";s:4:\"name\";s:7:\"Firefox\";s:10:\"short_name\";s:2:\"FF\";s:7:\"version\";s:4:\"77.0\";s:6:\"engine\";s:5:\"Gecko\";s:14:\"engine_version\";s:0:\"\";}", "desktop", "Mac", "MAC", "10.15", "", "AP", "", "dsggzl6k5lt1rs3qkq313jo", "819"]:  SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0' for key 'PRIMARY'" at /home/www/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 55 {"exception":"[object] (Doctrine\\DBAL\\Exception\\UniqueConstraintViolationException(code: 0): An exception occurred while executing 'INSERT INTO lead_devices (date_added, client_info, device, device_os_name, device_os_shortname, device_os_version, device_os_platform, device_brand, device_model, tracking_id, lead_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)' with params [\"2021-04-21 09:23:49\", \"a:6:{s:4:\\\"type\\\";s:7:\\\"browser\\\";s:4:\\\"name\\\";s:7:\\\"Firefox\\\";s:10:\\\"short_name\\\";s:2:\\\"FF\\\";s:7:\\\"version\\\";s:4:\\\"77.0\\\";s:6:\\\"engine\\\";s:5:\\\"Gecko\\\";s:14:\\\"engine_version\\\";s:0:\\\"\\\";}\", \"desktop\", \"Mac\", \"MAC\", \"10.15\", \"\", \"AP\", \"\", \"dsggzl6k5lt1rs3qkq313jo\", \"819\"]:\n\nSQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0' for key 'PRIMARY' at /home/www/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:55, Doctrine\\DBAL\\Driver\\PDOException(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0' for key 'PRIMARY' at /home/www/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:123, PDOException(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0' for key 'PRIMARY' at /home/www/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:121)"} []
[2021-04-21 09:51:51] mautic.CRITICAL: Uncaught PHP Exception Doctrine\DBAL\Exception\UniqueConstraintViolationException: "An exception occurred while executing 'INSERT INTO lead_devices (date_added, client_info, device, device_os_name, device_os_shortname, device_os_version, device_os_platform, device_brand, device_model, tracking_id, lead_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)' with params ["2021-04-21 09:51:50", "a:6:{s:4:\"type\";s:7:\"browser\";s:4:\"name\";s:7:\"Firefox\";s:10:\"short_name\";s:2:\"FF\";s:7:\"version\";s:4:\"88.0\";s:6:\"engine\";s:5:\"Gecko\";s:14:\"engine_version\";s:0:\"\";}", "desktop", "Windows", "WIN", "10", "x64", "", "", "67mh0nkd2wsl2iqudnlsp9z", "820"]:  SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0' for key 'PRIMARY'" at /home/www/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 55 {"exception":"[object] (Doctrine\\DBAL\\Exception\\UniqueConstraintViolationException(code: 0): An exception occurred while executing 'INSERT INTO lead_devices (date_added, client_info, device, device_os_name, device_os_shortname, device_os_version, device_os_platform, device_brand, device_model, tracking_id, lead_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)' with params [\"2021-04-21 09:51:50\", \"a:6:{s:4:\\\"type\\\";s:7:\\\"browser\\\";s:4:\\\"name\\\";s:7:\\\"Firefox\\\";s:10:\\\"short_name\\\";s:2:\\\"FF\\\";s:7:\\\"version\\\";s:4:\\\"88.0\\\";s:6:\\\"engine\\\";s:5:\\\"Gecko\\\";s:14:\\\"engine_version\\\";s:0:\\\"\\\";}\", \"desktop\", \"Windows\", \"WIN\", \"10\", \"x64\", \"\", \"\", \"67mh0nkd2wsl2iqudnlsp9z\", \"820\"]:\n\nSQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0' for key 'PRIMARY' at /home/www/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:55, Doctrine\\DBAL\\Driver\\PDOException(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0' for key 'PRIMARY' at /home/www/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:123, PDOException(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0' for key 'PRIMARY' at /home/www/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:121)"} []
[2021-04-21 11:58:38] mautic.CRITICAL: Uncaught PHP Exception Doctrine\DBAL\Exception\UniqueConstraintViolationException: "An exception occurred while executing 'INSERT INTO lead_devices (date_added, client_info, device, device_os_name, device_os_shortname, device_os_version, device_os_platform, device_brand, device_model, tracking_id, lead_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)' with params ["2021-04-21 09:58:38", "a:6:{s:4:\"type\";s:7:\"browser\";s:4:\"name\";s:7:\"Firefox\";s:10:\"short_name\";s:2:\"FF\";s:7:\"version\";s:4:\"88.0\";s:6:\"engine\";s:5:\"Gecko\";s:14:\"engine_version\";s:0:\"\";}", "desktop", "Windows", "WIN", "10", "x64", "", "", "zz8poqg2682q8kllcyvamqn", "821"]:  SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0' for key 'PRIMARY'" at /home/www/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 55 {"exception":"[object] (Doctrine\\DBAL\\Exception\\UniqueConstraintViolationException(code: 0): An exception occurred while executing 'INSERT INTO lead_devices (date_added, client_info, device, device_os_name, device_os_shortname, device_os_version, device_os_platform, device_brand, device_model, tracking_id, lead_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)' with params [\"2021-04-21 09:58:38\", \"a:6:{s:4:\\\"type\\\";s:7:\\\"browser\\\";s:4:\\\"name\\\";s:7:\\\"Firefox\\\";s:10:\\\"short_name\\\";s:2:\\\"FF\\\";s:7:\\\"version\\\";s:4:\\\"88.0\\\";s:6:\\\"engine\\\";s:5:\\\"Gecko\\\";s:14:\\\"engine_version\\\";s:0:\\\"\\\";}\", \"desktop\", \"Windows\", \"WIN\", \"10\", \"x64\", \"\", \"\", \"zz8poqg2682q8kllcyvamqn\", \"821\"]:\n\nSQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0' for key 'PRIMARY' at /home/www/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:55, Doctrine\\DBAL\\Driver\\PDOException(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0' for key 'PRIMARY' at /home/www/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:123, PDOException(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0' for key 'PRIMARY' at /home/www/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:121)"} []

Steps I have tried to fix the problem:

I double checked all steps mentioned here: Update Failed | Mautic and ended up with a manual new installation considered as last step.
Using the existing already upgraded database still leads me to the error 500.
Tried to switch back to Mautic v. 2 with database backup of v2., but I get the same error and behavior.

Any idea?

Thanks!

Meanwhile I upgraded to v. 3.3.3, but still the same problem: When I am not logged in in mautic, on my landing page is shown"500 Internal Server Error".

No one any idea?

I have the exact same problem. Would be nice to get a hint here. thanks in advance to all contributing!

alguien q pueda solucionar eso, necesito dessuscribirme de los correos electrónicos, gracias.

Uh oh! I think I broke it. If I do it again, please report me to the system administrator!

500 Internal Server Error

-Mautibot

https://emails.tutellus.com/email/unsubscribe/61eee5af18d88137243178
https://emails.tutellus.com/email/unsubscribe/620537897fdb6978712263

@blu-it
Your database table called lead_devices - this has duplicate info it is trying to insert.
What you could do is try to remove the entries here, if you are not bothered about the stats

Your errors is
[2021-04-21 07:03:53] mautic.CRITICAL: Uncaught PHP Exception Doctrine\DBAL\Exception\UniqueConstraintViolationException: "An exception occurred while executing 'INSERT INTO lead_devices (date_added

1062 Duplicate entry '0' for key 'PRIMARY'" at

Ensure you backup the data before trying this.

M