# Cleaning a mailing list (inactive users)

**URL:** https://forum.mautic.org/t/cleaning-a-mailing-list-inactive-users/9739
**Category:** Product Support
**Created:** [October 19, 2017, 3:13pm UTC](https://forum.mautic.org/t/cleaning-a-mailing-list-inactive-users/9739 "2017-10-19T15:13:49Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![chris\_zappar](https://avatars.discourse-cdn.com/v4/letter/c/a4c791/32.png) [@chris\_zappar](https://forum.mautic.org/u/chris_zappar)
#### Post date: [October 19, 2017, 3:13pm UTC](https://forum.mautic.org/t/cleaning-a-mailing-list-inactive-users/9739/1 "2017-10-19T15:13:49Z")

</div>

I am attempting to set up a clean on my mailing list which removes users that have not opened an email or been active on my website for greater than 3/6 months. I want to remove these users from my newsletter segment as is described in this article ([https://kb.mailchimp.com/accounts/compliance-tips/about-list-cleaning](https://kb.mailchimp.com/accounts/compliance-tips/about-list-cleaning))  
  
  
  
I found this post on github [https://github.com/mautic/mautic/issues/1818](https://github.com/mautic/mautic/issues/1818) and followed the instructions. I created a brand new segment using the following filter.  
  
Date Last Active - less than or equal to - 3 months  
  
  
  
However my developer has just informed me that it is causing the following issue in Mautic which is preventing other segments from being updated.  
  
  
  
mautic.NOTICE: DoctrineDBALExceptionUniqueConstraintViolationException: An exception occurred while executing ‘INSERT INTO zw\_lead\_lists\_leads (date\_added, manually\_removed, manually\_added, leadlist\_id, lead\_id) VALUES (?, ?, ?, ?, ?)’ with params [“2017-10-19 15:38:07”, 0, 0, 78, “197796”]: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘78-197796’ for key ‘PRIMARY’ (uncaught exception) at /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 66 while running console command `mautic:segments:update` [] []  
  
  
  
Does anyone have any advice on why this might be happening and how I can solve this?

---

<div class="post-metadata">

### Author: ![chris\_zappar](https://avatars.discourse-cdn.com/v4/letter/c/a4c791/32.png) [@chris\_zappar](https://forum.mautic.org/u/chris_zappar)
#### Post date: [October 19, 2017, 3:13pm UTC](https://forum.mautic.org/t/cleaning-a-mailing-list-inactive-users/9739/2 "2017-10-19T15:13:49Z")

</div>

I am attempting to set up a clean on my mailing list which removes users that have not opened an email or been active on my website for greater than 3/6 months. I want to remove these users from my newsletter segment as is described in this article ([https://kb.mailchimp.com/accounts/compliance-tips/about-list-cleaning](https://kb.mailchimp.com/accounts/compliance-tips/about-list-cleaning))

I found this post on github [https://github.com/mautic/mautic/issues/1818](https://github.com/mautic/mautic/issues/1818) and followed the instructions. I created a brand new segment using the following filter.  
Date Last Active - less than or equal to - 3 months

However my developer has just informed me that it is causing the following issue in Mautic which is preventing other segments from being updated.

mautic.NOTICE: DoctrineDBALExceptionUniqueConstraintViolationException: An exception occurred while executing ‘INSERT INTO zw\_lead\_lists\_leads (date\_added, manually\_removed, manually\_added, leadlist\_id, lead\_id) VALUES (?, ?, ?, ?, ?)’ with params [“2017-10-19 15:38:07”, 0, 0, 78, “197796”]: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘78-197796’ for key ‘PRIMARY’ (uncaught exception) at /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 66 while running console command `mautic:segments:update` [] []

Does anyone have any advice on why this might be happening and how I can solve this?
