# 500 error when selecting Channels-\>Text Messages

**URL:** <https://forum.mautic.org/t/500-error-when-selecting-channels-text-messages/17795>\
**Category:** Product Support\
**Created:** [January 14, 2021, 8:01pm UTC](https://forum.mautic.org/t/500-error-when-selecting-channels-text-messages/17795 "2021-01-14T20:01:27Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![131events](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/131events/32/4104_2.png) [@131events](https://forum.mautic.org/u/131events)\
**Post date:** [January 14, 2021, 8:01pm UTC](https://forum.mautic.org/t/500-error-when-selecting-channels-text-messages/17795/1 "2021-01-14T20:01:27Z")

</div>

**Your software**  
My Mautic version is: 3.2.4  
My PHP version is: 7.2  
My Database type and version is: MySQL 5.7.31

Wondering if someone can help. Twilio installed, when I select CHANNELS -\> TEXT MESSAGES I briefly see the list of one test message I was working on setting up and then it bounces immediately to a 500 error.

I believe it’s a table name error, this should probably be mautic\_sms… and not mautic.sms… but I don’t know where to fix (or maybe my assumption is incorrect):  
Base table or view not found: 1146 Table ‘mautic.sms\_message\_list\_xref’ doesn’t exist

Full error message:  
[2021-01-14 12:53:46] mautic.CRITICAL: Uncaught PHP Exception Doctrine\DBAL\Exception\TableNotFoundException: “An exception occurred while executing ‘SELECT COUNT(DISTINCT l.id) FROM sms\_message\_list\_xref sml INNER JOIN mautic\_lead\_lists ll ON ll.id = sml.leadlist\_id and ll.is\_published = 1 INNER JOIN mautic\_lead\_lists\_leads lll ON lll.leadlist\_id = sml.leadlist\_id and lll.manually\_removed = 0 INNER JOIN mautic\_leads l ON lll.lead\_id = l.id WHERE (sml.sms\_id = ?) AND (((l.mobile IS NOT NULL) OR (l.mobile \<\> ‘’)) OR ((l.phone IS NOT NULL) OR (l.phone \<\> ‘’))) AND (NOT EXISTS (SELECT null FROM mautic\_sms\_message\_stats stat WHERE (stat.lead\_id = l.id) AND (stat.sms\_id = 1))) AND (NOT EXISTS (SELECT null FROM mautic\_lead\_donotcontact dnc WHERE (dnc.lead\_id = l.id) AND (dnc.channel = ‘sms’))) AND (NOT EXISTS (SELECT null FROM mautic\_message\_queue mq WHERE (mq.lead\_id = l.id) AND (mq.status \<\> ‘sent’) AND (mq.channel = ‘sms’))) ORDER BY lll.lead\_id ASC’ with params [1]: SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘mautic.sms\_message\_list\_xref’ doesn’t exist” at /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 42 {“exception”:"[object] (Doctrine\DBAL\Exception\TableNotFoundException(code: 0): An exception occurred while executing ‘SELECT COUNT(DISTINCT l.id) FROM sms\_message\_list\_xref sml INNER JOIN mautic\_lead\_lists ll ON ll.id = sml.leadlist\_id and ll.is\_published = 1 INNER JOIN mautic\_lead\_lists\_leads lll ON lll.leadlist\_id = sml.leadlist\_id and lll.manually\_removed = 0 INNER JOIN mautic\_leads l ON lll.lead\_id = l.id WHERE (sml.sms\_id = ?) AND (((l.mobile IS NOT NULL) OR (l.mobile \<\> ‘’)) OR ((l.phone IS NOT NULL) OR (l.phone \<\> ‘’))) AND (NOT EXISTS (SELECT null FROM mautic\_sms\_message\_stats stat WHERE (stat.lead\_id = l.id) AND (stat.sms\_id = 1))) AND (NOT EXISTS (SELECT null FROM mautic\_lead\_donotcontact dnc WHERE (dnc.lead\_id = l.id) AND (dnc.channel = ‘sms’))) AND (NOT EXISTS (SELECT null FROM mautic\_message\_queue mq WHERE (mq.lead\_id = l.id) AND (mq.status \<\> ‘sent’) AND (mq.channel = ‘sms’))) ORDER BY lll.lead\_id ASC’ with params [1]:\n\nSQLSTATE[42S02]: Base table or view not found: 1146 Table ‘mautic.sms\_message\_list\_xref’ doesn’t exist at /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:42, Doctrine\DBAL\Driver\PDOException(code: 42S02): SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘mautic.sms\_message\_list\_xref’ doesn’t exist at /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:123, PDOException(code: 42S02): SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘mautic.sms\_message\_list\_xref’ doesn’t exist at /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:121)"}

---

<div class="post-metadata">

**Author:** ![puneetsethi25](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/puneetsethi25/32/1128_2.png) [@puneetsethi25](https://forum.mautic.org/u/puneetsethi25)\
**Post date:** [March 20, 2021, 9:12am UTC](https://forum.mautic.org/t/500-error-when-selecting-channels-text-messages/17795/2 "2021-03-20T09:12:24Z")

</div>

Hey were you able to get this fixed?

---

<div class="post-metadata">

**Author:** ![131events](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/131events/32/4104_2.png) [@131events](https://forum.mautic.org/u/131events)\
**Post date:** [March 20, 2021, 9:35am UTC](https://forum.mautic.org/t/500-error-when-selecting-channels-text-messages/17795/3 "2021-03-20T09:35:48Z")

</div>

Nope, have kind of given up on it after trying so many different things to get it to work. No one seems to be able to answer the question.

---

<div class="post-metadata">

**Author:** ![EJL](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/ejl/32/12155_2.png) [@EJL](https://forum.mautic.org/u/EJL)\
**Post date:** [March 21, 2021, 3:21pm UTC](https://forum.mautic.org/t/500-error-when-selecting-channels-text-messages/17795/4 "2021-03-21T15:21:41Z")

</div>

have you considered updating to 3.3.1?

---

<div class="post-metadata">

**Author:** ![131events](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/131events/32/4104_2.png) [@131events](https://forum.mautic.org/u/131events)\
**Post date:** [March 21, 2021, 3:49pm UTC](https://forum.mautic.org/t/500-error-when-selecting-channels-text-messages/17795/5 "2021-03-21T15:49:32Z")

</div>

Yes, we’re completely current on Mautic versions. This problem has persisted through 3 updates of Mautic 3.x.x, as well as an update to php 7.4

---

<div class="post-metadata">

**Author:** ![EJL](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/ejl/32/12155_2.png) [@EJL](https://forum.mautic.org/u/EJL)\
**Post date:** [March 21, 2021, 4:04pm UTC](https://forum.mautic.org/t/500-error-when-selecting-channels-text-messages/17795/6 "2021-03-21T16:04:56Z")

</div>

**/bin/console doctrine:schema:update --force** I would try updating schema with this command. Check file permissions, and make sure line 3 of your app/config/local.php file line 3 is **‘db\_driver’ =\> ‘pdo\_mysql’,**

---

<div class="post-metadata">

**Author:** ![131events](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/131events/32/4104_2.png) [@131events](https://forum.mautic.org/u/131events)\
**Post date:** [March 21, 2021, 4:23pm UTC](https://forum.mautic.org/t/500-error-when-selecting-channels-text-messages/17795/7 "2021-03-21T16:23:57Z")

</div>

Thank you, already have done the doctrine update, file permissions have been set multiple times and local.php has that setting.

I’ve even reinstalled completely, keeping only local.php

---

<div class="post-metadata">

**Author:** ![131events](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/131events/32/4104_2.png) [@131events](https://forum.mautic.org/u/131events)\
**Post date:** [March 21, 2021, 4:28pm UTC](https://forum.mautic.org/t/500-error-when-selecting-channels-text-messages/17795/8 "2021-03-21T16:28:13Z")

</div>

Honestly I thought the doctrine update would fix it. The error is in the query string format,  
Mautic\_  
instead of  
Mautic.

I can’t find anywhere why this one table reference isn’t formatted correctly

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [March 22, 2021, 8:41am UTC](https://forum.mautic.org/t/500-error-when-selecting-channels-text-messages/17795/9 "2021-03-22T08:41:42Z")

</div>

> [@131events](#):
>
> mautic.sms\_message\_list\_xref

Is this happening when you use link tracking in SMS? (If the setting is set as YES in your config / sms settings)

---

<div class="post-metadata">

**Author:** ![131events](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/131events/32/4104_2.png) [@131events](https://forum.mautic.org/u/131events)\
**Post date:** [March 22, 2021, 4:23pm UTC](https://forum.mautic.org/t/500-error-when-selecting-channels-text-messages/17795/10 "2021-03-22T16:23:52Z")

</div>

No, that setting doesn’t make any difference.

It’s an error in the query build, a table name reference is incorrect, an underscore instead of a period.

It’s mautic\_sms\_message\_list\_xref instead of mautic.sms\_message\_list\_xref

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [March 22, 2021, 4:44pm UTC](https://forum.mautic.org/t/500-error-when-selecting-channels-text-messages/17795/11 "2021-03-22T16:44:45Z")

</div>

Oh okay 🙂  
Can you create a github issue?

---

<div class="post-metadata">

**Author:** ![131events](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/131events/32/4104_2.png) [@131events](https://forum.mautic.org/u/131events)\
**Post date:** [March 23, 2021, 4:47pm UTC](https://forum.mautic.org/t/500-error-when-selecting-channels-text-messages/17795/12 "2021-03-23T16:47:43Z")

</div>

Can you send a link to the correct repository for this?

Thanks

---

<div class="post-metadata">

**Author:** ![EJL](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/ejl/32/12155_2.png) [@EJL](https://forum.mautic.org/u/EJL)\
**Post date:** [March 23, 2021, 5:38pm UTC](https://forum.mautic.org/t/500-error-when-selecting-channels-text-messages/17795/13 "2021-03-23T17:38:07Z")

</div>

> **[mautic/mautic](https://github.com/mautic/mautic/issues)**
>
> s

---

<div class="post-metadata">

**Author:** ![131events](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/131events/32/4104_2.png) [@131events](https://forum.mautic.org/u/131events)\
**Post date:** [March 23, 2021, 5:57pm UTC](https://forum.mautic.org/t/500-error-when-selecting-channels-text-messages/17795/14 "2021-03-23T17:57:22Z")

</div>

I created the bug report, thank you for your help.

---

<div class="post-metadata">

**Author:** ![victortan2701](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/victortan2701/32/1468_2.png) [@victortan2701](https://forum.mautic.org/u/victortan2701)\
**Post date:** [May 20, 2021, 8:24am UTC](https://forum.mautic.org/t/500-error-when-selecting-channels-text-messages/17795/15 "2021-05-20T08:24:05Z")

</div>

Hi everyone, is there any updates on this? I am facing the same issue too.

---

<div class="post-metadata">

**Author:** ![131events](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/131events/32/4104_2.png) [@131events](https://forum.mautic.org/u/131events)\
**Post date:** [May 20, 2021, 1:10pm UTC](https://forum.mautic.org/t/500-error-when-selecting-channels-text-messages/17795/16 "2021-05-20T13:10:35Z")

</div>

Yes, this is a bug and it came back when I upgraded to 3.3.3. It’s a simple fix so I’m not sure why it hasn’t been resolved.

Link to fix: [500 error on SMS listing: /s/sms - bad query string · Issue #9814 · mautic/mautic · GitHub](https://github.com/mautic/mautic/issues/9814#issuecomment-821473755)

Fix:

The tablename prefix was missing in the query builder. you just need to add. just need to add that at these 2 places:

```auto
line# 149 - app/bundles/SmsBundle/Entity/Sms.php
->setJoinTable(MAUTIC_TABLE_PREFIX.'sms_message_list_xref')

```

and on

```auto
line# 75 - app/bundles/SmsBundle/Entity/SmsRepository.php
$q->from(MAUTIC_TABLE_PREFIX.'sms_message_list_xref', 'sml')

```

---

<div class="post-metadata">

**Author:** ![victortan2701](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/victortan2701/32/1468_2.png) [@victortan2701](https://forum.mautic.org/u/victortan2701)\
**Post date:** [May 21, 2021, 5:14am UTC](https://forum.mautic.org/t/500-error-when-selecting-channels-text-messages/17795/17 "2021-05-21T05:14:10Z")

</div>

Awesome. Thanks alot mate.
