I'm currently in the process of migration a Magento project to Magento 2.2.2.

During Data migration I get this error:

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '21-152' for key 'EAV_ENTITY_ATTRIBUTE_ATTRIBUTE_SET_ID_ATTRIBUTE_ID'

My understanding is that there are 2+ duplicate entries 21-152 in the eav_entity_attribute table for columns attribute_set_id and attribute_id - so I thought to just delete the duplicate.

But there is no duplicate entry with that value in the source database...in fact, there is no such value in that table (in any column).

While in the destination database, this table is completely empty.

So I'm really not sure what the problem is or how to fix it...

Does anyone know what Duplicate entry 21-152 means exactly?

Or if someone could suggest an approach how to handle this issue?


Seems that the entry 21-152 referenced attribute_set_id = 21 and attribute_id = 152.

These IDs didn't exist in the source or destination databases, but during migration, the default attribute set of products in M2 received the id 21.

The problem was actually caused by the changed Default attribute set name in my M2 instance (I changed it to something other than Default).

Changing the name back to Default fixed this issue for me.

Maybe this will help others...

Several advice for migrating:

Always backup your M2 database during migration, so you can restore it if the migration fails. And always migrate with a clean DB (without previous attempts to migrate).

Remove all custom attribute sets and custom attributes from M2 if they already exist in M1.

  • I am not changed the attribute_set name in M2 Db, still same issue exists.
    – Manjunath
    Jan 20 '20 at 7:13

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.