1

enter image description here

Magento 2 - Item (Magento\Catalog\Model\ResourceModel\Eav\Attribute\Interceptor) with the same id already exist

2
  • can you please add more detail in your question ? Commented Jul 24, 2018 at 9:12
  • some category url through this error. other are working on frontent. Commented Jul 24, 2018 at 9:13

2 Answers 2

2

TL;DR:

The error 'Item with the same ID ... already exist' happens when Magento tries to load a collection with an SQL query which does not return distinct rows.

You need to find out where the collection is being loaded and what SQL query is being used in order to start debugging the problem.

In more detail:

When Magento loads a collection, it uses the ORM design pattern. Briefly, this means that an SQL query is run and every row of the result set is turned into an object. By 'turned into' I mean a new object is instantiated and then the columns of the result row are added as properties to the object. These objects are then added to an instance of the Collection class. The error you're experiencing is because Magento checks that each object in the collection is unique, i.e. That the ID of each object is unique. If it isn't, then Magento throws the 'Item with the same ID ... already exist' error.

If this is a part of Magento you've not modified, then it is most likely an extension or a theme which is using a plugin or event/observer in order to modify the query for the collection.

0

It's a new answer to a very old question but I keep having this happen to me.

The duplicates can be in a database row or coming from a join.

Causes: migrating/importing data between sites, removing/renaming attributes or attribute options outside the admin UI (module updates, database etc.)

Other things can cause this but if you have one in a category it is most likely an attribute used in layered navigation or sorting order.

First place to look is attribute option values and attribute labels - in my experience that is where duplicates happen when you copy live site product data over test site product data

eav_attribute_option_value eav_attribute_label

If there are no duplicates there, then you're into a bit more detective work and looking for mismatches between values in the catalog product attribute values and existing attributes - or attribute values both in varchar and text, for example, because an attribute changed. That's rarer but magento 1->2 migration used to cause some.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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