# "Rebuilding leads for campaign 1" Cron Error

**URL:** <https://forum.mautic.org/t/rebuilding-leads-for-campaign-1-cron-error/3352>\
**Category:** Product Support\
**Created:** [January 30, 2016, 4:07am UTC](https://forum.mautic.org/t/rebuilding-leads-for-campaign-1-cron-error/3352 "2016-01-30T04:07:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![pfgannon](https://avatars.discourse-cdn.com/v4/letter/p/aeb1de/32.png) [@pfgannon](https://forum.mautic.org/u/pfgannon)\
**Post date:** [January 30, 2016, 4:07am UTC](https://forum.mautic.org/t/rebuilding-leads-for-campaign-1-cron-error/3352/1 "2016-01-30T04:07:22Z")

</div>

Hey all, love the product so far. Excited to really make use of it.  
  
  
  
Everything seems to be working, EXCEPT I’m getting this error from one of my cron jobs. This is the full text of the cron notification email I’m getting:

Code:

Rebuilding leads for campaign 1

[DoctrineDBALDBALException]  
An exception occurred while executing ‘SELECT max(list\_leads.lead\_id) as max\_id, count(distinct(list\_leads.lead\_id)) as lead\_count FROM lead\_lists\_leads list\_leads WHERE (list\_leads.manually\_removed = ?) AND (list\_leads.leadlist\_id IN ()) AND (list\_leads.date\_added \<= ‘2016-01-30 03:45:03’) AND (NOT EXISTS (SELECT null FROM campaign\_leads campaign\_leads WHERE (campaign\_leads.lead\_id = list\_leads.lead\_id) AND (campaign\_leads.manually\_removed = ?) AND (campaign\_leads.campaign\_id = 1)))’ with params [0, 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 ')) AND (list\_leads.date\_added \<= ‘2016-01-30 03:45:03’) AND (NOT EXISTS (SELECT ’ at line 1

[PDOException]  
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 ')) AND (list\_leads.date\_added \<= ‘2016-01-30 03:45:03’) AND (NOT EXISTS (SELECT ’ at line 1

mautic:campaigns:update [-l|–batch-limit[="…"]] [-m|–max-leads[="…"]] [-i|–campaign-id[="…"]] [-f|–force]

Content-type: text/html

  
All other crons seem to be working.  
  
Is this a known issue? I wasn't able to find anything related, here or on github.  
Any solution?  
How will this effect my installation until it's fixed?

---

<div class="post-metadata">

**Author:** ![pfgannon](https://avatars.discourse-cdn.com/v4/letter/p/aeb1de/32.png) [@pfgannon](https://forum.mautic.org/u/pfgannon)\
**Post date:** [January 30, 2016, 4:07am UTC](https://forum.mautic.org/t/rebuilding-leads-for-campaign-1-cron-error/3352/2 "2016-01-30T04:07:22Z")

</div>

Hey all, love the product so far. Excited to really make use of it.

Everything seems to be working, EXCEPT I’m getting this error from one of my cron jobs. This is the full text of the cron notification email I’m getting:

```auto
Rebuilding leads for campaign 1

  [DoctrineDBALDBALException]
  An exception occurred while executing 'SELECT max(list_leads.lead_id) as max_id, count(distinct(list_leads.lead_id)) as lead_count FROM lead_lists_leads list_leads WHERE (list_leads.manually_removed = ?) AND (list_leads.leadlist_id IN ()) AND (list_leads.date_added <= '2016-01-30 03:45:03') AND (NOT EXISTS (SELECT null FROM campaign_leads campaign_leads WHERE (campaign_leads.lead_id = list_leads.lead_id) AND (campaign_leads.manually_removed = ?) AND (campaign_leads.campaign_id = 1)))' with params [0, 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 ')) AND (list_leads.date_added <= '2016-01-30 03:45:03') AND (NOT EXISTS (SELECT ' at line 1

  [PDOException]
  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 ')) AND (list_leads.date_added <= '2016-01-30 03:45:03') AND (NOT EXISTS (SELECT ' at line 1

mautic:campaigns:update [-l|--batch-limit[="..."]] [-m|--max-leads[="..."]] [-i|--campaign-id[="..."]] [-f|--force]

Content-type: text/html

```

All other crons seem to be working.

Is this a known issue? I wasn’t able to find anything related, here or on github.  
Any solution?  
How will this effect my installation until it’s fixed?

---

<div class="post-metadata">

**Author:** ![escopecz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/escopecz/32/370_2.png) [@escopecz](https://forum.mautic.org/u/escopecz)\
**Post date:** [February 1, 2016, 5:35pm UTC](https://forum.mautic.org/t/rebuilding-leads-for-campaign-1-cron-error/3352/3 "2016-02-01T17:35:21Z")

</div>

What Mautic version do you run? I think that this was fixed in 1.2.4.

---

<div class="post-metadata">

**Author:** ![pfgannon](https://avatars.discourse-cdn.com/v4/letter/p/aeb1de/32.png) [@pfgannon](https://forum.mautic.org/u/pfgannon)\
**Post date:** [February 4, 2016, 3:35pm UTC](https://forum.mautic.org/t/rebuilding-leads-for-campaign-1-cron-error/3352/4 "2016-02-04T15:35:37Z")

</div>

That appears to have fixed it, thanks!
