Exception #0 (Exception): Item (Magento\Eav\Model\

Hello,
the migration (from 1.9.9.1 to 2.2.8) is finished without errors (yeah!) but when I try to access to a product on backend I receive the following error. How to solve?

1 exception(s):
Exception #0 (Exception): Item (Magento\Eav\Model\Entity\Attribute) with the same ID "383" already exists.

Exception #0 (Exception): Item (Magento\Eav\Model\Entity\Attribute) with the same ID "383" already exists.
<pre>#1 Magento\Framework\Data\Collection\AbstractDb->loadWithFilter() called at [vendor/magento/framework/Data/Collection/AbstractDb.php:559]
#2 Magento\Framework\Data\Collection\AbstractDb->load() called at [vendor/magento/framework/Data/Collection.php:331]
#3 Magento\Framework\Data\Collection->getItems() called at [vendor/magento/module-catalog/Ui/DataProvider/Product/Form/Modifier/Eav.php:559]
#4 Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\Eav->loadAttributesForGroups() called at [vendor/magento/module-catalog/Ui/DataProvider/Product/Form/Modifier/Eav.php:532]
#5 Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\Eav->getAttributes() called at [vendor/magento/module-catalog/Ui/DataProvider/Product/Form/Modifier/Eav.php:281]
#6 Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\Eav->modifyMeta() called at [vendor/magento/module-catalog/Ui/DataProvider/Product/Form/ProductDataProvider.php:73]
#7 Magento\Catalog\Ui\DataProvider\Product\Form\ProductDataProvider->getMeta() called at [vendor/magento/framework/View/Element/UiComponentFactory.php:310]
#8 Magento\Framework\View\Element\UiComponentFactory->mergeMetadata() called at [vendor/magento/framework/View/Element/UiComponentFactory.php:216]
#9 Magento\Framework\View\Element\UiComponentFactory->create() called at [vendor/magento/framework/View/Layout/Generator/UiComponent.php:135]
#10 Magento\Framework\View\Layout\Generator\UiComponent->generateComponent() called at [vendor/magento/framework/View/Layout/Generator/UiComponent.php:97]
#11 Magento\Framework\View\Layout\Generator\UiComponent->process() called at [vendor/magento/framework/View/Layout/GeneratorPool.php:80]
#12 Magento\Framework\View\Layout\GeneratorPool->process() called at [vendor/magento/framework/View/Layout.php:343]
#13 Magento\Framework\View\Layout->generateElements() called at [vendor/magento/framework/View/Layout/Builder.php:129]
#14 Magento\Framework\View\Layout\Builder->generateLayoutBlocks() called at [vendor/magento/framework/View/Page/Builder.php:55]
#15 Magento\Framework\View\Page\Builder->generateLayoutBlocks() called at [vendor/magento/framework/View/Layout/Builder.php:65]
#16 Magento\Framework\View\Layout\Builder->build() called at [vendor/magento/framework/View/Layout.php:253]
#17 Magento\Framework\View\Layout->build() called at [vendor/magento/framework/View/Layout.php:875]
#18 Magento\Framework\View\Layout->getBlock() called at [vendor/magento/module-backend/Model/View/Result/Page.php:26]
#19 Magento\Backend\Model\View\Result\Page->setActiveMenu() called at [vendor/magento/module-catalog/Controller/Adminhtml/Product/Edit.php:69]
#20 Magento\Catalog\Controller\Adminhtml\Product\Edit->execute() called at [vendor/magento/framework/App/Action/Action.php:107]
#21 Magento\Framework\App\Action\Action->dispatch() called at [vendor/magento/module-backend/App/AbstractAction.php:235]
#22 Magento\Backend\App\AbstractAction->dispatch() called at [vendor/magento/framework/Interception/Interceptor.php:58]
#23 Magento\Catalog\Controller\Adminhtml\Product\Edit\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138]
#24 Magento\Catalog\Controller\Adminhtml\Product\Edit\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/module-backend/App/Action/Plugin/Authentication.php:143]
#25 Magento\Backend\App\Action\Plugin\Authentication->aroundDispatch() called at [vendor/magento/framework/Interception/Interceptor.php:135]
#26 Magento\Catalog\Controller\Adminhtml\Product\Edit\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#27 Magento\Catalog\Controller\Adminhtml\Product\Edit\Interceptor->___callPlugins() called at [generated/code/Magento/Catalog/Controller/Adminhtml/Product/Edit/Interceptor.php:26]
#28 Magento\Catalog\Controller\Adminhtml\Product\Edit\Interceptor->dispatch() called at [vendor/magento/framework/App/FrontController.php:55]
#29 Magento\Framework\App\FrontController->dispatch() called at [vendor/magento/framework/Interception/Interceptor.php:58]
#30 Magento\Framework\App\FrontController\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138]
#31 Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#32 Magento\Framework\App\FrontController\Interceptor->___callPlugins() called at [generated/code/Magento/Framework/App/FrontController/Interceptor.php:26]
#33 Magento\Framework\App\FrontController\Interceptor->dispatch() called at [vendor/magento/framework/App/Http.php:136]
#34 Magento\Framework\App\Http->launch() called at [vendor/magento/framework/App/Bootstrap.php:257]
#35 Magento\Framework\App\Bootstrap->run() called at [pub/index.php:37]
</pre>

7 answers

Profile photo of Raffaele Baldi 130.00 $tone February 17, 2020
Public

For some products the error change in:
 

1 exception(s):
Exception #0 (Magento\Framework\Exception\LocalizedException): The configuration parameter "formElement" is a required for "smartprice_google_position" field.

Exception #0 (Magento\Framework\Exception\LocalizedException): The configuration parameter "formElement" is a required for "smartprice_google_position" field.
<pre>#1 Magento\Framework\View\Layout\Generator\UiComponent->prepareComponent() called at [vendor/magento/framework/View/Layout/Generator/UiComponent.php:156]
#2 Magento\Framework\View\Layout\Generator\UiComponent->prepareComponent() called at [vendor/magento/framework/View/Layout/Generator/UiComponent.php:156]
#3 Magento\Framework\View\Layout\Generator\UiComponent->prepareComponent() called at [vendor/magento/framework/View/Layout/Generator/UiComponent.php:156]
#4 Magento\Framework\View\Layout\Generator\UiComponent->prepareComponent() called at [vendor/magento/framework/View/Layout/Generator/UiComponent.php:137]
#5 Magento\Framework\View\Layout\Generator\UiComponent->generateComponent() called at [vendor/magento/framework/View/Layout/Generator/UiComponent.php:97]
#6 Magento\Framework\View\Layout\Generator\UiComponent->process() called at [vendor/magento/framework/View/Layout/GeneratorPool.php:80]
#7 Magento\Framework\View\Layout\GeneratorPool->process() called at [vendor/magento/framework/View/Layout.php:343]
#8 Magento\Framework\View\Layout->generateElements() called at [vendor/magento/framework/View/Layout/Builder.php:129]
#9 Magento\Framework\View\Layout\Builder->generateLayoutBlocks() called at [vendor/magento/framework/View/Page/Builder.php:55]
#10 Magento\Framework\View\Page\Builder->generateLayoutBlocks() called at [vendor/magento/framework/View/Layout/Builder.php:65]
#11 Magento\Framework\View\Layout\Builder->build() called at [vendor/magento/framework/View/Layout.php:253]
#12 Magento\Framework\View\Layout->build() called at [vendor/magento/framework/View/Layout.php:875]
#13 Magento\Framework\View\Layout->getBlock() called at [vendor/magento/module-backend/Model/View/Result/Page.php:26]
#14 Magento\Backend\Model\View\Result\Page->setActiveMenu() called at [vendor/magento/module-catalog/Controller/Adminhtml/Product/Edit.php:69]
#15 Magento\Catalog\Controller\Adminhtml\Product\Edit->execute() called at [vendor/magento/framework/App/Action/Action.php:107]
#16 Magento\Framework\App\Action\Action->dispatch() called at [vendor/magento/module-backend/App/AbstractAction.php:235]
#17 Magento\Backend\App\AbstractAction->dispatch() called at [vendor/magento/framework/Interception/Interceptor.php:58]
#18 Magento\Catalog\Controller\Adminhtml\Product\Edit\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138]
#19 Magento\Catalog\Controller\Adminhtml\Product\Edit\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/module-backend/App/Action/Plugin/Authentication.php:143]
#20 Magento\Backend\App\Action\Plugin\Authentication->aroundDispatch() called at [vendor/magento/framework/Interception/Interceptor.php:135]
#21 Magento\Catalog\Controller\Adminhtml\Product\Edit\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#22 Magento\Catalog\Controller\Adminhtml\Product\Edit\Interceptor->___callPlugins() called at [generated/code/Magento/Catalog/Controller/Adminhtml/Product/Edit/Interceptor.php:26]
#23 Magento\Catalog\Controller\Adminhtml\Product\Edit\Interceptor->dispatch() called at [vendor/magento/framework/App/FrontController.php:55]
#24 Magento\Framework\App\FrontController->dispatch() called at [vendor/magento/framework/Interception/Interceptor.php:58]
#25 Magento\Framework\App\FrontController\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138]
#26 Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#27 Magento\Framework\App\FrontController\Interceptor->___callPlugins() called at [generated/code/Magento/Framework/App/FrontController/Interceptor.php:26]
#28 Magento\Framework\App\FrontController\Interceptor->dispatch() called at [vendor/magento/framework/App/Http.php:136]
#29 Magento\Framework\App\Http->launch() called at [vendor/magento/framework/App/Bootstrap.php:257]
#30 Magento\Framework\App\Bootstrap->run() called at [pub/index.php:37]
</pre>
#2
Profile photo of Mall Staff 184060.00 $tone February 18, 2020
Public

Hi Raffaele,
I’d like to follow further below: 

1 exception(s):
Exception #0 (Exception): Item (Magento\Eav\Model\Entity\Attribute) with the same ID “383” already exists

That issue relates to the data in the url rewrite table which has some duplicated data. You can do steps as follows so that M2 can re-generate the URL rewrite of categories and associated products in your M2:

1 — In categories management, create a new root category named ‘Temp Root Category’
2 — Open Stores management, edit the default Store of the default Website and set the ‘Root Category’ form field to the newly added root category ‘Temp Root Category’ and click Save button.
3 — Once done, open Stores management once again, edit the default Store of the default Website and set the Root Category form field to the main root category which you want to publish in the storefront again and click Save button.
Magento will regenerate categories and associate products URLs rewrite in this step. It might take sometime to complete this task (It depends on the volume of categories and associated products)

And then, re-index the data and clean the Magento cache.

1 exception(s):
Exception #0 (Magento\Framework\Exception\LocalizedException): The configuration parameter “formElement” is a required for “smartprice_google_position” field.

It seems that the issue relates to the custom attribute code ‘smartprice_google_position’ which has the frontend_input type as ‘select/multiselect’. However, the needed backend_model or source_model were missing in M2. You can change the value of ‘frontend_input’ of that attribute to ‘text’ to solve the issue.

Regards,
Mall.

#3
Profile photo of Raffaele Baldi 130.00 $tone February 18, 2020
Public

Hello Mall,
for the first exception, I do exactly what you wrote but the error is not solved. Try to login to the migrated ecommerce (you already have credentials in your email) and try to edit the product with SKU ARCBBLC900E
 
Please list the steps you will take because I will have to replicate them when I go live on the real Magento 2.
 
Regards

#4
Profile photo of Mall Staff 184060.00 $tone February 18, 2020
Public

Hi Raffaele,

SKU ARCBBLC900E

I checked the product you mentioned and saw the issue you mentioned: https://prnt.sc/r3x11t

That issue relates to some bad data settings in the attribute data section which is similar to the case in this post:
https://magento.stackexchange.com/questions/257922/error-with-magento-eav-model-entity-attribute-how-to-fix

I have applied a quick workaround referred to in that post to your M2 instance (http://prntscr.com/r3x49z) and the issue solved. 

However, after doing that, I saw another issue as you mentioned in your reply #2: https://prnt.sc/r3x3bi. This issue relates to the custom attribute code ‘smartprice_google_position’ which had missing frontend_input type: http://prntscr.com/r3x6ke.

You can change the value of ‘frontend_input’ of that attribute to ‘text’ to solve the issue. You can run this SQL query in M2 database to update: 

UPDATE eav_entity_attribute SET frontend_input = 'text' Where attribute_code = 'smartprice_google_position';

Regards,
Mall.

#5
Profile photo of Raffaele Baldi 130.00 $tone February 18, 2020
Public

Hello Mall,
thank you so much! You’re a great developer and this software is magic!
 
The query to fix the second error should be the follows (the right table is eav_attribute, not eav_entity_attribute):
 
UPDATE eav_attribute SET frontend_input = ‘text’ Where attribute_code = ‘smartprice_google_position’

#6
Profile photo of ubdev Staff 98030.00 $tone February 19, 2020
Public

Hi Raffaele,
You’re right with the query. I am glad that it helped. 
Please move forward with the process at your end, if you have any additional question, feel free to get back to us here.
Regards,
Ubertheme team

#7

Please login or Register to Submit Answer

Written By

Comments