Title: An exception occurred while executing a query
Last modified: August 4, 2026

---

# An exception occurred while executing a query

 *  [GERT](https://wordpress.org/support/users/xmoxx69/)
 * (@xmoxx69)
 * [4 days, 2 hours ago](https://wordpress.org/support/topic/an-exception-occurred-while-executing-a-query/)
 * An exception occurred while executing a query: Duplicate entry ‘0’ for key ‘PRIMARY’
 * Bei dem Plugin ist ein unerwarteter Fehler aufgetreten. Bitte lade die Seite 
   neu. Wenn das nicht hilft, [installiere das MailPoet-Plugin erneut.](https://kb.mailpoet.com/article/258-re-installing-updating-the-plugin-via-ftp)
 * Nach dem ich das 5 mal gemacht habe immer wieder der gleiche Fehler ????
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fan-exception-occurred-while-executing-a-query%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 1 replies (of 1 total)

 *  Plugin Support [nathvi V. a11n](https://wordpress.org/support/users/nathvi/)
 * (@nathvi)
 * [2 days, 18 hours ago](https://wordpress.org/support/topic/an-exception-occurred-while-executing-a-query/#post-18984914)
 * Hi [@xmoxx69](https://wordpress.org/support/users/xmoxx69/) 
   This “Duplicate 
   entry ‘0’ for key ‘PRIMARY'” error, combined with the plugin becoming unusable
   right after reactivation, points to a database issue rather than a plugin files
   issue. Reinstalling MailPoet only replaces the plugin’s code, it doesn’t touch
   the data already stored in your MailPoet database tables, so if one of those 
   tables has a corrupted or duplicated row, the same error will keep appearing 
   no matter how many times you reinstall.
 * Here’s how to resolve it:
    1. Back up your subscribers and newsletters first. Go to MailPoet > Subscribers
       and export your lists to CSV, and note down or export any newsletters or automations
       you want to keep. See this guide for more detail: How to Migrate MailPoet Database
       Tables ([https://kb.mailpoet.com/article/377-how-to-migrate-mailpoet-database-tables](https://kb.mailpoet.com/article/377-how-to-migrate-mailpoet-database-tables))
    2. Once you have your data backed up, go to MailPoet > Settings > Advanced tab,
       and use the “Reinstall from scratch” option. This removes and rebuilds all of
       MailPoet’s database tables from a clean state, which clears out the corrupted
       row causing the primary key conflict. You can find details on this option here:
       Settings > The Advanced Tab ([https://kb.mailpoet.com/article/138-the-advanced-tab](https://kb.mailpoet.com/article/138-the-advanced-tab))
 * Please note this action is irreversible and will remove all existing MailPoet
   data (subscribers, lists, newsletters, settings), so the backup in step 1 is 
   important before proceeding.
    3. After the reinstall completes, re-import your subscriber lists from the CSV 
       you exported.
 * This should let MailPoet initialize cleanly without hitting the existing corrupted
   table data. Let us know how it goes.

Viewing 1 replies (of 1 total)

You must be [logged in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fan-exception-occurred-while-executing-a-query%2F%3Foutput_format%3Dmd&locale=en_US)
to reply to this topic.

 * ![](https://ps.w.org/mailpoet/assets/icon-256x256.png?rev=3284564)
 * [MailPoet - Newsletters, Email Marketing, and Automation](https://wordpress.org/plugins/mailpoet/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/mailpoet/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/mailpoet/)
 * [Active Topics](https://wordpress.org/support/plugin/mailpoet/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/mailpoet/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/mailpoet/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [nathvi V. a11n](https://wordpress.org/support/users/nathvi/)
 * Last activity: [2 days, 18 hours ago](https://wordpress.org/support/topic/an-exception-occurred-while-executing-a-query/#post-18984914)
 * Status: not resolved