# Unable to update segments

**URL:** <https://forum.mautic.org/t/unable-to-update-segments/28652>\
**Category:** Product Support\
**Created:** [July 19, 2023, 4:20pm UTC](https://forum.mautic.org/t/unable-to-update-segments/28652 "2023-07-19T16:20:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![precords](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/precords/32/1504_2.png) [@precords](https://forum.mautic.org/u/precords)\
**Post date:** [July 19, 2023, 4:20pm UTC](https://forum.mautic.org/t/unable-to-update-segments/28652/1 "2023-07-19T16:20:18Z")

</div>

**Your software**  
My Mautic version is: 4.3.1  
My PHP version is: 7.4.30  
My Database type and version is: 10.4.24-MariaDB

**Your problem**  
My problem is: Won’t update or rebuild segments

These errors are showing in the log:  
SELECT count(leadIdPrimary) count, max(leadIdPrimary) maxId, min(leadIdPrimary) minId FROM (SELECT DISTINCT l.id as leadIdPrimary FROM leads l WHERE (l.id IN (SELECT pars.lead\_id FROM lead\_tags\_xref pars WHERE pars.tag\_id IN ())) AND (l.id NOT IN (SELECT part.lead\_id FROM lead\_lists\_leads part WHERE part.leadlist\_id = ?))) sss’ with params [18]: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘))) AND (l.id NOT IN (SELECT part.lead\_id FROM lead\_lists\_leads part WHERE pa…’ at line 1 (uncaught exception) at /home/\***/public\_html/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 98 while running console command `mautic:segments:update` [] {“hostname”:"**.com",“pid”:2054728}

Steps I have tried to fix the problem:

> <https://stackoverflow.com/questions/4544051/sqlstate42000-syntax-error-or-access-violation-1064-you-have-an-error-in-you>

Was trying to find where to turn emulation off but can’t find out how to do this.  
Maybe someone has an idea how to fix the problem column. look like a missing " ’ " tick or something like this…

---

<div class="post-metadata">

**Author:** ![precords](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/precords/32/1504_2.png) [@precords](https://forum.mautic.org/u/precords)\
**Post date:** [July 22, 2023, 6:27am UTC](https://forum.mautic.org/t/unable-to-update-segments/28652/2 "2023-07-22T06:27:30Z")

</div>

Ok, I’ll answer my own question. First advice is to run ALL cron jobs in your SSH console so you can see what the errors are. I found a segment that was choking on this code but other segments were rebuilt. This segment had a filter that was not set to anything. It is a segment that i manually add and used for testing only so no updating of it is possible or desirable. So… I deleted this filter and segment update worked perfectly. 🙂 All systems go after debugging another cron task of downloading IP. Memory limit problem, but since I’m using different versions on my server I was setting memory limit in wrong php.ini. Once set correctly in the version of php for my user from 128M to1024M, memory issue went away immediately.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/1X/43c63600fe51440378769136903f1fa2a9a34102.png) [@system](https://forum.mautic.org/u/system)\
**Post date:** [July 24, 2023, 7:41am UTC](https://forum.mautic.org/t/unable-to-update-segments/28652/3 "2023-07-24T07:41:29Z")

</div>

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.
