Segments page. 500 Internal Server Error

Your software
My Mautic version is:4.4.10

Your problem
My problem is:already the second day, I have an error when going to the “segments” page. 500 Internal Server Error

Please help me

500 error is very general. You will need to check the logs to get a better error message to see what is wrong.

In the settings under system info there is a log section that might show the error message. If there is an error share there here.

If there is no error showing there you will need to check some other logs that require looking into a few folders and files on your server. Do you have terminal/console/cli/putty access to your server?

[2023-09-08 13:31:27] mautic.CRITICAL: Uncaught PHP Exception Doctrine\DBAL\Exception\DriverException: “An exception occurred while executing ‘SELECT count(l.lead_id) as thecount, l.leadlist_id FROM lead_lists_leads l USE INDEX (manually_removed) WHERE (l.leadlist_id = 21) AND (l.manually_removed = ?) GROUP BY l.leadlist_id’ with params [0]: SQLSTATE[42000]: Syntax error or access violation: 1176 Key ‘manually_removed’ doesn’t exist in table ‘l’” at /var/www/html/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 count(l.lead_id) as thecount, l.leadlist_id FROM lead_lists_leads l USE INDEX (manually_removed) WHERE (l.leadlist_id = 21) AND (l.manually_removed = ?) GROUP BY l.leadlist_id’ with params [0]:\n\nSQLSTATE[42000]: Syntax error or access violation: 1176 Key ‘manually_removed’ doesn’t exist in table ‘l’ at /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:128, Doctrine\DBAL\Driver\PDO\Exception(code: 42000): SQLSTATE[42000]: Syntax error or access violation: 1176 Key ‘manually_removed’ doesn’t exist in table ‘l’ at /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDO/Exception.php:18, PDOException(code: 42000): SQLSTATE[42000]: Syntax error or access violation: 1176 Key ‘manually_removed’ doesn’t exist in table ‘l’ at /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:117)”} {“hostname”:“creditgo_mautic”,“pid”:11065}

The log entry you provided is a critical error message from Mautic. It indicates that an uncaught PHP exception of type Doctrine\DBAL\Exception\DriverException has occurred while executing a SQL query. The error message suggests a problem with the SQL query itself, specifically, the use of an index named “manually_removed” on table “l,” which doesn’t exist in the table structure.

"An exception occurred while executing 'SELECT count(l.lead_id) as thecount, l.leadlist_id FROM lead_lists_leads l USE INDEX (manually_removed) WHERE (l.leadlist_id = 21) AND (l.manually_removed = ?) GROUP BY l.leadlist_id' with params [0]: SQLSTATE[42000]: Syntax error or access violation: 1176 Key 'manually_removed' doesn't exist in table 'l'" :

The error message, which indicates that there is no “manually_removed” index in the “l” table.

I am not skilled enough with Mysql to help much further but “Manually” suggests you perhaps have edited some data in the database directly and this is causing issues. The issue seems to be the segment with ID 21.

Hopefully some with more techy skills can see the issue and guide you on how to fix it.

Tray to access to yourdomain(dot)com/s/update/schema

If that does not work, and you have access to the console, you can also run the command directly from the console:

bin/console doctrine:migrations:migrate

Hey, I have the same problem when entering contacts or segments section. Did you have any fix for that? It happened when migrating from 5.0.0 to 5.2.0, and now I can’t even revert back to 5.0.0 because i got the same DB error.