magento / magento/data-migration-tool

Exception #0 (Exception): Item (Magento\Wishlist\Model\Item) with the same ID "9980" already exists.

Open
#837 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
339
Forks
195
PR merge metrics
No merged PRs in 30d

Description

### Preconditions
1. Magento 1 ver. 1.9.4.4 with PHP 5.6
2. Magento 2 ver. 2.3.5-p2 with PHP 7.3

### Steps to reproduce
1. Install Migration tool
2. Migrate settings
3. Migrate Data
4. Login into a customer account
5. Add a product to the wishlist

### Expected result
Adding products to the wishlist should work without any errors

### Actual result
After clicking on "Add to wishlist", I'm getting this error `(Exception): Item (Magento\Wishlist\Model\Item) with the same ID "9980" already exists.`

```
1 exception(s):
Exception #0 (Exception): Item (Magento\Wishlist\Model\Item) with the same ID "9980" already exists.

Exception #0 (Exception): Item (Magento\Wishlist\Model\Item) with the same ID "9980" already exists.

#1 Magento\Framework\Data\Collection\AbstractDb->loadWithFilter(false, false) called at [vendor/magento/framework/Data/Collection/AbstractDb.php:565]

#2 Magento\Framework\Data\Collection\AbstractDb->load() called at [vendor/magento/framework/Data/Collection.php:849]
#3 Magento\Framework\Data\Collection->count() called at [vendor/magento/module-wishlist/Model/Wishlist.php:634]
#4 Magento\Wishlist\Model\Wishlist->getItemsCount() called at [vendor/magento/module-wishlist/Block/AbstractBlock.php:276]
#5 Magento\Wishlist\Block\AbstractBlock->getWishlistItemsCount() called at [generated/code/Magento/Wishlist/Block/Customer/Wishlist/Interceptor.php:297]
#6 Magento\Wishlist\Block\Customer\Wishlist\Interceptor->getWishlistItemsCount() called at [vendor/magento/module-wishlist/Block/AbstractBlock.php:301]
#7 Magento\Wishlist\Block\AbstractBlock->hasWishlistItems() called at [generated/code/Magento/Wishlist/Block/Customer/Wishlist/Interceptor.php:323]
#8 Magento\Wishlist\Block\Customer\Wishlist\Interceptor->hasWishlistItems() called at [vendor/magento/module-wishlist/view/frontend/templates/view.phtml:20]
#9 include('/home/mage2theru...') called at [vendor/magento/framework/View/TemplateEngine/Php.php:59]
#10 Magento\Framework\View\TemplateEngine\Php->render(&Magento\Wishlist\Block\Customer\Wishlist\Interceptor#000000001c63723e0000000019db5330#, '/home/mage2theru...', array('csp' => &Magento\Csp\Helper\InlineUtil#000000001c6365c20000000019db5330#)) called at [vendor/magento/framework/Interception/Interceptor.php:58]
#11 Magento\Framework\View\TemplateEngine\Php\Interceptor->___callParent('render', array(&Magento\Wishlist\Block\Customer\Wishlist\Interceptor#000000001c63723e0000000019db5330#, '/home/mage2theru...', array('csp' => &Magento\Csp\Helper\InlineUtil#000000001c6365c20000000019db5330#))) called at [vendor/magento/framework/Interception/Interceptor.php:138]
#12 Magento\Framework\View\TemplateEngine\Php\Interceptor->Magento\Framework\Interception\{closure}(&Magento\Wishlist\Block\Customer\Wishlist\Interceptor#000000001c63723e0000000019db5330#, '/home/mage2theru...', array()) called at [vendor/magento/framework/Interception/Interceptor.php:153]
#13 Magento\Framework\View\TemplateEngine\Php\Interceptor->___callPlugins('render', array(&Magento\Wishlist\Block\Customer\Wishlist\Interceptor#000000001c63723e0000000019db5330#, '/home/mage2theru...', array()), array(array('csp_helper_plugi...'))) called at [generated/code/Magento/Framework/View/TemplateEngine/Php/Interceptor.php:26]
#14 Magento\Framework\View\TemplateEngine\Php\Interceptor->render(&Magento\Wishlist\Block\Customer\Wishlist\Interceptor#000000001c63723e0000000019db5330#, '/home/mage2theru...', array()) called at [vendor/magento/framework/View/Element/Template.php:271]
#15 Magento\Framework\View\Element\Template->fetchView('/home/mage2theru...') called at [generated/code/Magento/Wishlist/Block/Customer/Wishlist/Interceptor.php:726]
#16 Magento\Wishlist\Block\Customer\Wishlist\Interceptor->fetchView('/home/mage2theru...') called at [vendor/magento/framework/View/Element/Template.php:301]
#17 Magento\Framework\View\Element\Template->_toHtml() called at [vendor/magento/module-wishlist/Block/Customer/Wishlist.php:275]
#18 Magento\Wishlist\Block\Customer\Wishlist->_toHtml() called at [vendor/magento/framework/View/Element/AbstractBlock.php:1100]
#19 Magento\Framework\View\Element\AbstractBlock->Magento\Framework\View\Element\{closure}() called at [vendor/magento/framework/View/Element/AbstractBlock.php:1104]
#20 Magento\Framework\View\Element\AbstractBlock->_loadCache() called at [vendor/magento/framework/View/Element/AbstractBlock.php:674]
#21 Magento\Framework\View\Element\AbstractBlock->toHtml() called at [generated/code/Magento/Wishlist/Block/Customer/Wishlist/Interceptor.php:1051]
#22 Magento\Wishlist\Block\Customer\Wishlist\Interceptor->toHtml() called at [vendor/magento/framework/View/Layout.php:566]
#23 Magento\Framework\View\Layout->_renderBlock('customer.wishlis...') called at [vendor/magento/framework/View/Layout.php:542]
#24 Magento\Framework\View\Layout->renderNonCachedElement('customer.wishlis...') called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:206]
#25 Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('customer.wishlis...') called at [vendor/magento/framework/View/Layout.php:497]
#26 Magento\Framework\View\Layout->renderElement('customer.wishlis...', false) called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:193]
#27 Magento\Framework\View\Layout\Interceptor->renderElement('customer.wishlis...', false) called at [vendor/magento/framework/View/Layout.php:594]
#28 Magento\Framework\View\Layout->_renderContainer('content', false) called at [vendor/magento/framework/View/Layout.php:544]
#29 Magento\Framework\View\Layout->renderNonCachedElement('content') called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:206]
#30 Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('content') called at [vendor/magento/framework/View/Layout.php:497]
#31 Magento\Framework\View\Layout->renderElement('content', false) called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:193]
#32 Magento\Framework\View\Layout\Interceptor->renderElement('content', false) called at [vendor/magento/framework/View/Layout.php:594]
#33 Magento\Framework\View\Layout->_renderContainer('main', false) called at [vendor/magento/framework/View/Layout.php:544]
#34 Magento\Framework\View\Layout->renderNonCachedElement('main') called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:206]
#35 Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('main') called at [vendor/magento/framework/View/Layout.php:497]
#36 Magento\Framework\View\Layout->renderElement('main', false) called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:193]
#37 Magento\Framework\View\Layout\Interceptor->renderElement('main', false) called at [vendor/magento/framework/View/Layout.php:594]
#38 Magento\Framework\View\Layout->_renderContainer('columns', false) called at [vendor/magento/framework/View/Layout.php:544]
#39 Magento\Framework\View\Layout->renderNonCachedElement('columns') called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:206]
#40 Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('columns') called at [vendor/magento/framework/View/Layout.php:497]
#41 Magento\Framework\View\Layout->renderElement('columns', false) called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:193]
#42 Magento\Framework\View\Layout\Interceptor->renderElement('columns', false) called at [vendor/magento/framework/View/Layout.php:594]
#43 Magento\Framework\View\Layout->_renderContainer('main.content', false) called at [vendor/magento/framework/View/Layout.php:544]
#44 Magento\Framework\View\Layout->renderNonCachedElement('main.content') called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:206]
#45 Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('main.content') called at [vendor/magento/framework/View/Layout.php:497]
#46 Magento\Framework\View\Layout->renderElement('main.content', false) called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:193]
#47 Magento\Framework\View\Layout\Interceptor->renderElement('main.content', false) called at [vendor/magento/framework/View/Layout.php:594]
#48 Magento\Framework\View\Layout->_renderContainer('page.wrapper', false) called at [vendor/magento/framework/View/Layout.php:544]
#49 Magento\Framework\View\Layout->renderNonCachedElement('page.wrapper') called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:206]
#50 Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('page.wrapper') called at [vendor/magento/framework/View/Layout.php:497]
#51 Magento\Framework\View\Layout->renderElement('page.wrapper', false) called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:193]
#52 Magento\Framework\View\Layout\Interceptor->renderElement('page.wrapper', false) called at [vendor/magento/framework/View/Layout.php:594]
#53 Magento\Framework\View\Layout->_renderContainer('root', false) called at [vendor/magento/framework/View/Layout.php:544]
#54 Magento\Framework\View\Layout->renderNonCachedElement('root') called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:206]
#55 Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('root') called at [vendor/magento/framework/View/Layout.php:497]
#56 Magento\Framework\View\Layout->renderElement('root', true) called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:193]
#57 Magento\Framework\View\Layout\Interceptor->renderElement('root') called at [vendor/magento/framework/View/Layout.php:963]
#58 Magento\Framework\View\Layout->getOutput() called at [vendor/magento/framework/Interception/Interceptor.php:58]
#59 Magento\Framework\View\Layout\Interceptor->___callParent('getOutput', array()) called at [vendor/magento/framework/Interception/Interceptor.php:138]
#60 Magento\Framework\View\Layout\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#61 Magento\Framework\View\Layout\Interceptor->___callPlugins('getOutput', array(), array(array('layout-model-cac...'))) called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:494]
#62 Magento\Framework\View\Layout\Interceptor->getOutput() called at [vendor/magento/framework/View/Result/Page.php:258]
#63 Magento\Framework\View\Result\Page->render(&Magento\Framework\App\Response\Http\Interceptor#000000001c6378500000000019db5330#) called at [vendor/magento/framework/View/Result/Layout.php:171]
#64 Magento\Framework\View\Result\Layout->renderResult(&Magento\Framework\App\Response\Http\Interceptor#000000001c6378500000000019db5330#) called at [vendor/magento/framework/Interception/Interceptor.php:58]
#65 Magento\Framework\View\Result\Page\Interceptor->___callParent('renderResult', array(&Magento\Framework\App\Response\Http\Interceptor#000000001c6378500000000019db5330#)) called at [vendor/magento/framework/Interception/Interceptor.php:138]
#66 Magento\Framework\View\Result\Page\Interceptor->Magento\Framework\Interception\{closure}(&Magento\Framework\App\Response\Http\Interceptor#000000001c6378500000000019db5330#) called at [vendor/magento/framework/Interception/Interceptor.php:153]
#67 Magento\Framework\View\Result\Page\Interceptor->___callPlugins('renderResult', array(&Magento\Framework\App\Response\Http\Interceptor#000000001c6378500000000019db5330#), array(array('result-messages', 'result-builtin-c...', 'result-varnish-c...'))) called at [generated/code/Magento/Framework/View/Result/Page/Interceptor.php:130]
#68 Magento\Framework\View\Result\Page\Interceptor->renderResult(&Magento\Framework\App\Response\Http\Interceptor#000000001c6378500000000019db5330#) called at [vendor/magento/framework/App/Http.php:120]
#69 Magento\Framework\App\Http->launch() called at [generated/code/Magento/Framework/App/Http/Interceptor.php:24]
#70 Magento\Framework\App\Http\Interceptor->launch() called at [vendor/magento/framework/App/Bootstrap.php:261]
#71 Magento\Framework\App\Bootstrap->run(&Magento\Framework\App\Http\Interceptor#000000001c63784b0000000019db5330#) called at [index.php:39]

```

### Additional notes
- There is an already opened issue on the Magento main repo https://github.com/magento/magento2/issues/27137 but I opened this issue here because I got this error after migrating from M1

- I also tried to truncate these tables `wishlist`, `wishlist_item` & `wishlist_item_option` and I got the same error `Exception #0 (Exception): Item (Magento\Wishlist\Model\Item) with the same ID "1" already exists.`

Contributor guide

Open the contributing guide

Research direction

Reproduce the migration and wishlist flow described in the issue, then start at vendor/magento/framework/Data/Collection/AbstractDb.php:565 and vendor/magento/module-wishlist/Model/Wishlist.php:634 from the stack trace. Trace why the migrated wishlist collection contains duplicate item ID 9980; done means adding a product to the wishlist completes without the duplicate-ID exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend, database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.