# Cannot View Contacts - Error 500 (Console)

**URL:** <https://forum.mautic.org/t/cannot-view-contacts-error-500-console/8796>\
**Category:** Product Support\
**Created:** [June 22, 2017, 2:22pm UTC](https://forum.mautic.org/t/cannot-view-contacts-error-500-console/8796 "2017-06-22T14:22:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![aaronlroberts](https://avatars.discourse-cdn.com/v4/letter/a/5daacb/32.png) [@aaronlroberts](https://forum.mautic.org/u/aaronlroberts)\
**Post date:** [June 22, 2017, 2:22pm UTC](https://forum.mautic.org/t/cannot-view-contacts-error-500-console/8796/1 "2017-06-22T14:22:00Z")

</div>

All of a sudden, cannot view any contacts. Cannot verify when this started and have followed various advice (e.g. disabling custom fields) to try and resolve this, but cannot view any contacts at all.  
  
  
  
Console reports:

Code:

https://updates.cluj-napoca.xyz/s/contacts/view/21?\_=1498144749836&mauticUserLastActive=1&mauticLastNotificationId=

  
Error Log reports:

Code:

[2017-06-22 15:20:02] mautic.NOTICE: DoctrineDBALExceptionSyntaxErrorException: An exception occurred while executing 'SELECT count(distinct(l.id)) as lead\_count, max(l.id) as max\_id FROM leads l INNER JOIN lead\_lists\_leads ll ON l.id = ll.lead\_id WHERE (ll.date\_added \<= '2017-06-22 15:20:02') AND (ll.manually\_added = ?) AND (ll.leadlist\_id = 1) AND (l.id NOT IN (SELECT l.id FROM leads l INNER JOIN companies\_leads cl ON l.id = cl.lead\_id INNER JOIN companies comp ON cl.company\_id = comp.id WHERE (comp.subindustry IN ('Bars / Pubs')) AND (()) GROUP BY l.id))' with params [0]: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')) GROUP BY l.id))' at line 1 (uncaught exception) at /xxx/xxxx/xxxxx/xxxxxx/public\_html/updates\_cluj-napoca\_xyz/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 90 while running console command `mautic:segments:update` [] []

  
Note, I've replaced some server directories with X's for security reasons.  
  
Also when I save a contact (via Edit) I receive:  
  
Console reports:

Code:

libraries.js?v3c5fbb70:673 POST https://updates.cluj-napoca.xyz/s/contacts/edit/21?mauticUserLastActive=1&mauticLastNotificationId= 500 (Internal Server Error)

  
Log reports:

Code:

[2017-06-22 15:36:01] mautic.NOTICE: DoctrineDBALExceptionSyntaxErrorException: An exception occurred while executing 'SELECT count(distinct(l.id)) as lead\_count, max(l.id) as max\_id FROM leads l INNER JOIN lead\_lists\_leads ll ON l.id = ll.lead\_id WHERE (ll.date\_added \<= '2017-06-22 15:36:01') AND (ll.manually\_added = ?) AND (ll.leadlist\_id = 1) AND (l.id NOT IN (SELECT l.id FROM leads l INNER JOIN companies\_leads cl ON l.id = cl.lead\_id INNER JOIN companies comp ON cl.company\_id = comp.id WHERE (comp.subindustry IN ('Bars / Pubs')) AND (()) GROUP BY l.id))' with params [0]: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')) GROUP BY l.id))' at line 1 (uncaught exception) at /xx/xxx/xxxx/xxxxx/public\_html/updates\_cluj-napoca\_xyz/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 90 while running console command `mautic:segments:update` [] []

  
I cannot seem to figure out what's going on here ![:(]( ":(")!! But it's a real problem right now.

---

<div class="post-metadata">

**Author:** ![aaronlroberts](https://avatars.discourse-cdn.com/v4/letter/a/5daacb/32.png) [@aaronlroberts](https://forum.mautic.org/u/aaronlroberts)\
**Post date:** [June 22, 2017, 2:22pm UTC](https://forum.mautic.org/t/cannot-view-contacts-error-500-console/8796/2 "2017-06-22T14:22:00Z")

</div>

All of a sudden, cannot view any contacts. Cannot verify when this started and have followed various advice (e.g. disabling custom fields) to try and resolve this, but cannot view any contacts at all.

Console reports:

```auto
https://updates.cluj-napoca.xyz/s/contacts/view/21?_=1498144749836&mauticUserLastActive=1&mauticLastNotificationId=
```

Error Log reports:

```auto
[2017-06-22 15:20:02] mautic.NOTICE: DoctrineDBALExceptionSyntaxErrorException: An exception occurred while executing 'SELECT count(distinct(l.id)) as lead_count, max(l.id) as max_id FROM leads l INNER JOIN lead_lists_leads ll ON l.id = ll.lead_id WHERE (ll.date_added <= '2017-06-22 15:20:02') AND (ll.manually_added = ?) AND (ll.leadlist_id = 1) AND (l.id NOT IN (SELECT l.id FROM leads l INNER JOIN companies_leads cl ON l.id = cl.lead_id INNER JOIN companies comp ON cl.company_id = comp.id WHERE (comp.subindustry IN ('Bars / Pubs')) AND (()) GROUP BY l.id))' with params [0]: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')) GROUP BY l.id))' at line 1 (uncaught exception) at /xxx/xxxx/xxxxx/xxxxxx/public_html/updates_cluj-napoca_xyz/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 90 while running console command `mautic:segments:update` [] []
```

Note, I’ve replaced some server directories with X’s for security reasons.

Also when I save a contact (via Edit) I receive:

Console reports:

```auto
libraries.js?v3c5fbb70:673 POST https://updates.cluj-napoca.xyz/s/contacts/edit/21?mauticUserLastActive=1&mauticLastNotificationId= 500 (Internal Server Error)
```

Log reports:

```auto
[2017-06-22 15:36:01] mautic.NOTICE: DoctrineDBALExceptionSyntaxErrorException: An exception occurred while executing 'SELECT count(distinct(l.id)) as lead_count, max(l.id) as max_id FROM leads l INNER JOIN lead_lists_leads ll ON l.id = ll.lead_id WHERE (ll.date_added <= '2017-06-22 15:36:01') AND (ll.manually_added = ?) AND (ll.leadlist_id = 1) AND (l.id NOT IN (SELECT l.id FROM leads l INNER JOIN companies_leads cl ON l.id = cl.lead_id INNER JOIN companies comp ON cl.company_id = comp.id WHERE (comp.subindustry IN ('Bars / Pubs')) AND (()) GROUP BY l.id))' with params [0]: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')) GROUP BY l.id))' at line 1 (uncaught exception) at /xx/xxx/xxxx/xxxxx/public_html/updates_cluj-napoca_xyz/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 90 while running console command `mautic:segments:update` [] []
```

I cannot seem to figure out what’s going on here :(!! But it’s a real problem right now.

---

<div class="post-metadata">

**Author:** ![thecodeine](https://avatars.discourse-cdn.com/v4/letter/t/e47c2d/32.png) [@thecodeine](https://forum.mautic.org/u/thecodeine)\
**Post date:** [June 23, 2017, 1:00pm UTC](https://forum.mautic.org/t/cannot-view-contacts-error-500-console/8796/3 "2017-06-23T13:00:47Z")

</div>

Your problem is in query ,AND (())’’. Somehow Mautic created wrong query, it’s probably a bug. You can report it on github.

---

<div class="post-metadata">

**Author:** ![aaronlroberts](https://avatars.discourse-cdn.com/v4/letter/a/5daacb/32.png) [@aaronlroberts](https://forum.mautic.org/u/aaronlroberts)\
**Post date:** [June 27, 2017, 12:25pm UTC](https://forum.mautic.org/t/cannot-view-contacts-error-500-console/8796/4 "2017-06-27T12:25:28Z")

</div>

Thanks! Yeah, bit of a mystery, I ended up just reinstalling the system from scratch. Thanks for the heads up!

---

<div class="post-metadata">

**Author:** ![petertl](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/petertl/32/511_2.png) [@petertl](https://forum.mautic.org/u/petertl)\
**Post date:** [June 27, 2017, 12:48pm UTC](https://forum.mautic.org/t/cannot-view-contacts-error-500-console/8796/5 "2017-06-27T12:48:53Z")

</div>

Besides the `AND (())` it may somehow have to do with your custom field “subindustry”. At least I don’t have it in my companies table.
