I have a client call and say he could not re-index after importing 100 products. I attempted to re-index in shell and received this error

exception 'PDOException' with message 'SQLSTATE23000: Integrity constraint violation: 1062 Duplicate entry '9243-159-1-555' for key 'PRIMARY'' in 

I learned that the client was testing his 100 new products on the production server (and not staging), seeing that we have a Staging and Development server.

  • The spreadsheet is formated correctly without duplicates. The attribute is always a Multi-select Oct 2, 2013 at 19:06

3 Answers 3


So I actually solved the problem so I figured it would be helpful for others to know the answer:

Firstly, I backed up and restored the production database to my local. I then looked up the attribute (ID 159) and found its model. I learned it was "Varchar"

Then I searched the database for that ID

SELECT * FROM catalog_product_entity_varchar where attribute_id = 159;

I then found the entity ID 9243 (So I could have just did a query for both)

The value was something like this '555,369,555'

I grabbed the value_id and removed the row (on my test system)

delete FROM catalog_product_entity_varchar where value_id = 1134979;

I then re-indexed and it worked!

  • I would suggest you dig further into the root cause of the problem. This could be a bug in magento's import process or some bad data in the import file. You've only alleviated a symptom.
    – beeplogic
    Sep 25, 2013 at 15:35
  • Client started an import, then stopped it half way, pretty generic version of Magento Sep 25, 2013 at 19:08
  • Did your client use Dataflow or some custom importing program? There should be transactions implemented to avoid multiple-table inserts.
    – laketuna
    Oct 2, 2013 at 23:06
  • Standard dataflow Oct 3, 2013 at 2:46

We have discovered that simply opening the offending product and re-saving this also solves the problem


We had the same Problem in Magento CE

In this case it was not any Magento bug. It was a bad data problem in the import file as we tried to import 2 identical attributes for the respective products (we tried to import the color of a T-shirt with option red and option red again in two consecutive rows analogously).

Because of the large quantity of products with "Duplicate entry" problems we could not solve this manually. So we cleaned up the import file and this solved the problem.

For an explanation in German, please see: Magento Produkt Import und die Neu-Indizierung

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.