# An exception occurred while executing REPLACE INTO campaign\_lead\_event\_failed\_log

**URL:** <https://forum.mautic.org/t/an-exception-occurred-while-executing-replace-into-campaign-lead-event-failed-log/14479>\
**Category:** Product Support\
**Created:** [May 24, 2020, 6:18pm UTC](https://forum.mautic.org/t/an-exception-occurred-while-executing-replace-into-campaign-lead-event-failed-log/14479 "2020-05-24T18:18:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![alexrm1x](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/alexrm1x/32/2500_2.png) [@alexrm1x](https://forum.mautic.org/u/alexrm1x)\
**Post date:** [May 24, 2020, 6:18pm UTC](https://forum.mautic.org/t/an-exception-occurred-while-executing-replace-into-campaign-lead-event-failed-log/14479/1 "2020-05-24T18:18:31Z")

</div>

**Your software**  
My Mautic version is: 2.16.2  
My PHP version is: 7.3.18

**Your problem**  
My problem is:  
Running email fetches with command: console mautic:email:fetch in Terminal shows::  
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 ':dateAdded as date\_added, :message as reason from campaign\_lead\_event\_log  
WHERE ’ at line 2

That only happened once, but similar errors started to appear in the Mautic Logs):

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 ':dateAdded as date\_added, :message as reason from campaign\_lead\_event\_log  
WHERE ’ at line 2

These errors are showing in the log:  
[2020-05-24 12:32:57] mautic.CRITICAL: Uncaught PHP Exception Doctrine\DBAL\Exception\SyntaxErrorException: “An exception occurred while executing ‘REPLACE INTO campaign\_lead\_event\_failed\_log( `log_id`, `date_added`, `reason`) SELECT id, :dateAdded as date\_added, :message as reason from campaign\_lead\_event\_log WHERE is\_scheduled = 1 AND lead\_id = :contactId AND campaign\_id = :campaignId AND rotation = :rotation’: 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 ':dateAdded as date\_added, :message as reason from campaign\_lead\_event\_log WHERE ’ at line 2” at /home/carameltrail/public\_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 90 {“exception”:"[object] (Doctrine\DBAL\Exception\SyntaxErrorException(code: 0): An exception occurred while executing ‘REPLACE INTO campaign\_lead\_event\_failed\_log( `log_id`, `date_added`, `reason`)\nSELECT id, :dateAdded as date\_added, :message as reason from campaign\_lead\_event\_log\nWHERE is\_scheduled = 1 AND lead\_id = :contactId AND campaign\_id = :campaignId AND rotation = :rotation’:\n\nYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':dateAdded as date\_added, :message as reason from campaign\_lead\_event\_log\nWHERE ’ at line 2 at /home/carameltrail/public\_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:90, Doctrine\DBAL\Driver\Mysqli\MysqliException(code: 0): 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 ':dateAdded as date\_added, :message as reason from campaign\_lead\_event\_log\nWHERE ’ at line 2 at /home/carameltrail/public\_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php:101)"}

[2020-05-24 14:00:02] mautic.ERROR: CAMPAIGN: An exception occurred while executing ‘REPLACE INTO campaign\_lead\_event\_failed\_log( `log_id`, `date_added`, `reason`) SELECT id, :dateAdded as date\_added, :message as reason from campaign\_lead\_event\_log WHERE is\_scheduled = 1 AND lead\_id = :contactId AND campaign\_id = :campaignId AND rotation = :rotation’: 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 ':dateAdded as date\_added, :message as reason from campaign\_lead\_event\_log WHERE ’ at line 2

Steps I have tried to fix the problem:  
I saw using driver mysqli can cause something related there can be still a bug in the code.

---

<div class="post-metadata">

**Author:** ![alexrm1x](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/alexrm1x/32/2500_2.png) [@alexrm1x](https://forum.mautic.org/u/alexrm1x)\
**Post date:** [May 24, 2020, 6:24pm UTC](https://forum.mautic.org/t/an-exception-occurred-while-executing-replace-into-campaign-lead-event-failed-log/14479/2 "2020-05-24T18:24:20Z")

</div>

Went to EasyApache4 and enabled php73-php-pdo (pdo\_mysql)

Changed value of property ‘db\_driver’ from ‘mysqli’ to ‘db\_driver’ =\> ‘pdo\_mysql’, in app/config/local.php

Cleared the cache with command rm -rf app/cache/prod/\* from the Mautic root directory.

Looks like it is working… no more errors logged (An exception occurred while executing 'REPLACE INTO campaign\_lead\_event\_failed\_log).

It looks like a regression of this bug:

> <https://github.com/mautic/mautic/pull/6574>
