#StackBounty: #error #error-message #magento2.4.2-p1 Error when copying a product or moving a category: The value specified in the URL …

Bounty: 100

Migrated Magento 1.9.4 --> Magento 2.4.2-p1

We migrated all data except orders from our production Magento 1.9.4 site to Magento 2.4.2-p1. Everything seems to work in the new Magento except when we copy an existing product or when I tried to move a category into another category, I get the following Error:

The value specified in the URL Key field would generate a URL that already exists.
To resolve this conflict, you can either change the value of the URL Key field (located in the Search Engine Optimization section) to a unique value, or change the Request Path fields in all locations listed below:

and then 9 products listed here

I googled this but all I find are never ending discussions and super-complicated steps to try. Is there a simple to implement solution I could do to fix this?

Here are my entries from exception.log:

[2021-08-01 15:49:02] main.CRITICAL: URL key for specified store already exists. {"exception":"[object] (Magento\UrlRewrite\Model\Exception\UrlAlreadyExistsException(code: 0): URL key for specified store already exists. at /home/myWEBSITE/public_html/vendor/magento/module-url-rewrite/Model/Storage/DbStorage.php:309, Magento\Framework\Exception\AlreadyExistsException(code: 0): URL key for specified store already exists. at /home/myWEBSITE/public_html/vendor/magento/module-url-rewrite/Model/Storage/DbStorage.php:342, Magento\Framework\DB\Adapter\DuplicateException(code: 1062): SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'fabbri-amarena-cherries-panettone-1000-gram-www-MYstore2-com.' for key 'MGET_URL_REWRITE_REQUEST_PATH_STORE_ID', query was: INSERT  INTO `mget_url_rewrite` (`redirect_type`,`is_autogenerated`,`metadata`,`description`,`entity_type`,`entity_id`,`request_path`,`target_path`,`store_id`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?) at /home/myWEBSITE/public_html/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php:599, Zend_Db_Statement_Exception(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'fabbri-amarena-cherries-panettone-1000-gram-www-MYstore2-com.' for key 'MGET_URL_REWRITE_REQUEST_PATH_STORE_ID', query was: INSERT  INTO `mget_url_rewrite` (`redirect_type`,`is_autogenerated`,`metadata`,`description`,`entity_type`,`entity_id`,`request_path`,`target_path`,`store_id`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?) at /home/myWEBSITE/public_html/vendor/magento/framework/DB/Statement/Pdo/Mysql.php:110, PDOException(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'fabbri-amarena-cherries-panettone-1000-gram-www-MYstore2-com.' for key 'MGET_URL_REWRITE_REQUEST_PATH_STORE_ID' at /home/myWEBSITE/public_html/vendor/magento/framework/DB/Statement/Pdo/Mysql.php:91)"} []
[2021-08-01 15:49:03] main.WARNING: Cannot gather stats! Warning!stat(): stat failed for /home/myWEBSITE/public_html/pub/media/catalog/product/f/a/fabbri_amarena_cherries_panettone_1000_gram_www.MYstore2.com_2.jpg {"exception":"[object] (Magento\Framework\Exception\FileSystemException(code: 0): Cannot gather stats! Warning!stat(): stat failed for /home/myWEBSITE/public_html/pub/media/catalog/product/f/a/fabbri_amarena_cherries_panettone_1000_gram_www.MYstore2.com_2.jpg at /home/myWEBSITE/public_html/vendor/magento/framework/Filesystem/Driver/File.php:95)"} []
[2021-08-01 15:49:19] main.WARNING: Cannot gather stats! Warning!stat(): stat failed for /home/myWEBSITE/public_html/pub/media/catalog/product/f/a/fabbri_amarena_cherries_panettone_1000_gram_www.MYstore2.com_2.jpg {"exception":"[object] (Magento\Framework\Exception\FileSystemException(code: 0): Cannot gather stats! Warning!stat(): stat failed for /home/myWEBSITE/public_html/pub/media/catalog/product/f/a/fabbri_amarena_cherries_panettone_1000_gram_www.MYstore2.com_2.jpg at /home/myWEBSITE/public_html/vendor/magento/framework/Filesystem/Driver/File.php:95)"} []
[2021-08-01 15:50:43] main.CRITICAL: URL key for specified store already exists. {"exception":"[object] (Magento\UrlRewrite\Model\Exception\UrlAlreadyExistsException(code: 0): URL key for specified store already exists. at /home/myWEBSITE/public_html/vendor/magento/module-url-rewrite/Model/Storage/DbStorage.php:309, Magento\Framework\Exception\AlreadyExistsException(code: 0): URL key for specified store already exists. at /home/myWEBSITE/public_html/vendor/magento/module-url-rewrite/Model/Storage/DbStorage.php:342, Magento\Framework\DB\Adapter\DuplicateException(code: 1062): SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'fabbri-amarena-cherries-panettone-1000-gram-www-MYstore2-com.' for key 'MGET_URL_REWRITE_REQUEST_PATH_STORE_ID', query was: INSERT  INTO `mget_url_rewrite` (`redirect_type`,`is_autogenerated`,`metadata`,`description`,`entity_type`,`entity_id`,`request_path`,`target_path`,`store_id`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?) at /home/myWEBSITE/public_html/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php:599, Zend_Db_Statement_Exception(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'fabbri-amarena-cherries-panettone-1000-gram-www-MYstore2-com.' for key 'MGET_URL_REWRITE_REQUEST_PATH_STORE_ID', query was: INSERT  INTO `mget_url_rewrite` (`redirect_type`,`is_autogenerated`,`metadata`,`description`,`entity_type`,`entity_id`,`request_path`,`target_path`,`store_id`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?) at /home/myWEBSITE/public_html/vendor/magento/framework/DB/Statement/Pdo/Mysql.php:110, PDOException(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'fabbri-amarena-cherries-panettone-1000-gram-www-MYstore2-com.' for key 'MGET_URL_REWRITE_REQUEST_PATH_STORE_ID' at /home/myWEBSITE/public_html/vendor/magento/framework/DB/Statement/Pdo/Mysql.php:91)"} []
[2021-08-01 15:50:44] main.WARNING: Cannot gather stats! Warning!stat(): stat failed for /home/myWEBSITE/public_html/pub/media/catalog/product/f/a/fabbri_amarena_cherries_panettone_1000_gram_www.MYstore2.com_2.jpg {"exception":"[object] (Magento\Framework\Exception\FileSystemException(code: 0): Cannot gather stats! Warning!stat(): stat failed for /home/myWEBSITE/public_html/pub/media/catalog/product/f/a/fabbri_amarena_cherries_panettone_1000_gram_www.MYstore2.com_2.jpg at /home/myWEBSITE/public_html/vendor/magento/framework/Filesystem/Driver/File.php:95)"} []
[2021-08-01 18:08:19] main.WARNING: Cannot gather stats! Warning!stat(): stat failed for /home/myWEBSITE/public_html/pub/media/catalog/product/f/a/fabbri_amarena_cherries_panettone_1000_gram_www.MYstore2.com_2.jpg {"exception":"[object] (Magento\Framework\Exception\FileSystemException(code: 0): Cannot gather stats! Warning!stat(): stat failed for /home/myWEBSITE/public_html/pub/media/catalog/product/f/a/fabbri_amarena_cherries_panettone_1000_gram_www.MYstore2.com_2.jpg at /home/myWEBSITE/public_html/vendor/magento/framework/Filesystem/Driver/File.php:95)"} []

I tried changing the URL Key for the first product and then moving the category again but it comes up with the same Error including a reference to the URL key of the first product (even-though I changed it already).


Edited on August 5th, 2021:

I’ve googled this and all the answers are quite complicated. I’m looking for a step-by-step solution as in do #1, then #2, then #3… and done!


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.