I am using the magento version 2.0.9 version for my site.
I am getting this Url key for specified store is already exist while updating the product or assigning the product for custom option and click on Save button.
I have deleted all entries in URL rewrite table in the database also. But I am still getting this error while updating any product.
Any idea for this error?
Best Answer
I came here searching for a similar issue but with Category save. So when I tried to save the category it threw same error "URL key for specified store already exists.".
After debugging by removing the
try..catch
block atinsertMultiple()
method ofMagento\UrlRewrite\Model\Storage\DbStorage
. I identified that while saving the category Magento was trying to re-build url rewrites for assigned products also. And few products had sameurl_key
and that was throwing duplicate records error. Asurl_rewrite
table has a UNIQUE contraint onrequest_path, store_id
columns.See
exception.log
to find out theurl_key
that is creating issue.So I just made the
url_key
unique for products and that resolved the issue.Hope these debugging steps may prove helpful to somebody who stumbles here again.