SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '2828-148-1-471' for key 'PRIMARY'

While trying to reindex your store using the command line, you stumble on the following error:
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '2828-148-1-471'  for key 'PRIMARY'


In the case of the product attribute indexer, this means there's a constraint error while saving a record to the catalog_product_index_eav_idx table.


How to find the product that is causing the issue:
2828-148-1-471 refers to:
  • product entity id: 2828
  • attribute id: 148
  • store id: 1
  • value: 471

Solutions:
The first solution to try would be to simply locate the product in your Magento backend and save it.  Once done, simply reindex your store from the command line and see if the problem occurs again.

The second one would be to delete the affected product followed by a full reindex.


In any cases, don't hesitate to open a ticket and have our team resolve that one.

  • 115 Users Found This Useful
Was this answer helpful?

Related Articles

Magento Best Practices

Magento can be very tricky.  And sometimes, it is getting quite confusing on how to properly...

How to add and edit static pages in Magento

To add and edit CMS static pages, log in to the admin panel of your Magento store and go to...

SCRIPT_NAME & SCRIPT_FILENAME errors with cron

CRON ErrorsYou may encounter those errors in your log while inspecting those:[23-Oct-2016...

Magento Version

You may want to know wich version of Magento that you are running.  An easy way to do it is from...

Numeric value out of range: 1690 BIGINT UNSIGNED

Description Recently when making some cleanup on a Magento based store that was having over 550K...