# Adding points to contact on email open throw SQL error

**URL:** <https://forum.mautic.org/t/adding-points-to-contact-on-email-open-throw-sql-error/9917>\
**Category:** Development\
**Created:** [November 16, 2017, 10:34am UTC](https://forum.mautic.org/t/adding-points-to-contact-on-email-open-throw-sql-error/9917 "2017-11-16T10:34:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Duff](https://avatars.discourse-cdn.com/v4/letter/d/958977/32.png) [@Duff](https://forum.mautic.org/u/Duff)\
**Post date:** [November 16, 2017, 10:34am UTC](https://forum.mautic.org/t/adding-points-to-contact-on-email-open-throw-sql-error/9917/1 "2017-11-16T10:34:25Z")

</div>

Hi guys,  
  
  
  
Just went live on Mautic with a first campaign sent to 75K contacts.  
  
  
  
Before sending the campaign, I set up the action of adding 1 point to a contact that would open the email (under Points \> Manage Actions). After sending the campaign, I have checked my logs and saw a bunch of SQL errors looking like this :

Code:

mautic.CRITICAL: Uncaught PHP Exception DoctrineDBALExceptionUniqueConstraintViolationException: "An exception occurred while executing 'INSERT INTO campaign\_lead\_event\_log (rotation, date\_triggered, is\_scheduled, trigger\_date, system\_triggered, metadata, channel, channel\_id, non\_action\_path\_taken, event\_id, lead\_id, campaign\_id, ip\_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)' with params [1, "2017-11-16 10:07:11", 0, null, 0, "a:0:{}", "email", 51, 0, 28, 26809, 8, 6]: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '28-26809-1' for key 'campaign\_rotation'" at /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 66 {"exception":"[object] (Doctrine\DBAL\Exception\UniqueConstraintViolationException(code: 0): An exception occurred while executing 'INSERT INTO campaign\_lead\_event\_log (rotation, date\_triggered, is\_scheduled, trigger\_date, system\_triggered, metadata, channel, channel\_id, non\_action\_path\_taken, event\_id, lead\_id, campaign\_id, ip\_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)' with params [1, "2017-11-16 10:07:11", 0, null, 0, "a:0:{}", "email", 51, 0, 28, 26809, 8, 6]:nnSQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '28-26809-1' for key 'campaign\_rotation' at /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:66, Doctrine\DBAL\Driver\PDOException(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '28-26809-1' for key 'campaign\_rotation' at /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:107, PDOException(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '28-26809-1' for key 'campaign\_rotation' at /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:105)"}

  
I think these errors are due to contacts opening the email twice.  
  
How does that sound to you ? Is there something I can do to prevent these errors ?  
  
Thanking you in advance,  
Cheers !  
.

---

<div class="post-metadata">

**Author:** ![Duff](https://avatars.discourse-cdn.com/v4/letter/d/958977/32.png) [@Duff](https://forum.mautic.org/u/Duff)\
**Post date:** [November 16, 2017, 10:34am UTC](https://forum.mautic.org/t/adding-points-to-contact-on-email-open-throw-sql-error/9917/2 "2017-11-16T10:34:25Z")

</div>

Hi guys,

Just went live on Mautic with a first campaign sent to 75K contacts.

Before sending the campaign, I set up the action of adding 1 point to a contact that would open the email (under Points \> Manage Actions). After sending the campaign, I have checked my logs and saw a bunch of SQL errors looking like this :

```auto
mautic.CRITICAL: Uncaught PHP Exception DoctrineDBALExceptionUniqueConstraintViolationException: "An exception occurred while executing 'INSERT INTO campaign_lead_event_log (rotation, date_triggered, is_scheduled, trigger_date, system_triggered, metadata, channel, channel_id, non_action_path_taken, event_id, lead_id, campaign_id, ip_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)' with params [1, "2017-11-16 10:07:11", 0, null, 0, "a:0:{}", "email", 51, 0, 28, 26809, 8, 6]: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '28-26809-1' for key 'campaign_rotation'" at /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 66 {"exception":"[object] (Doctrine\DBAL\Exception\UniqueConstraintViolationException(code: 0): An exception occurred while executing 'INSERT INTO campaign_lead_event_log (rotation, date_triggered, is_scheduled, trigger_date, system_triggered, metadata, channel, channel_id, non_action_path_taken, event_id, lead_id, campaign_id, ip_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)' with params [1, "2017-11-16 10:07:11", 0, null, 0, "a:0:{}", "email", 51, 0, 28, 26809, 8, 6]:nnSQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '28-26809-1' for key 'campaign_rotation' at /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:66, Doctrine\DBAL\Driver\PDOException(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '28-26809-1' for key 'campaign_rotation' at /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:107, PDOException(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '28-26809-1' for key 'campaign_rotation' at /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:105)"}
```

I think these errors are due to contacts opening the email twice.

How does that sound to you ? Is there something I can do to prevent these errors ?

Thanking you in advance,  
Cheers !  
.
