3

I added two categories with sub-categories from my ERP with an integration.

When I want to edit a category, I have an error "Unique constraint violation found".

Do you know how I can resolve this issue?

enter image description here

Log:

[code][2018-02-20 14:05:21] main.CRITICAL: Unique constraint violation found {"exception":"[object] (Magento\Framework\Exception\AlreadyExistsException(code: 0): Unique constraint violation found at /home/magento/www/vendor/magento/framework/EntityManager/Operation/Update.php:121, Magento\Framework\DB\Adapter\DuplicateException(code: 1062): SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'infusion-low-temp-curing/Rubber.html-1' for key 'URL_REWRITE_REQUEST_PATH_STORE_ID', query was: INSERT INTO url_rewrite (`redirect_ty.. [/code]

  • Are you editing or adding a new category? – Greg Feb 20 '18 at 13:46
  • Check your logs there should be more information about the constraint violated – vitoriodachef Feb 20 '18 at 13:55
1

The error log says that you are trying to do another insert with the same combination of columns that belong to URL_REWRITE table. The table is defied as UNIQUE and is not allowing same combination to be inserted twice.

  • Thanks. Do you know why the system triy to do another insert with the same combination when I want to save a modification on an existing category? – VP1354 Feb 20 '18 at 15:01
  • I had a very similar problem before, however, it was happening when customer tried to place an order and order could not be created because it it trying to assign an already existing order number (which has to be unique too). It happened because of customer session not being closed after purchase for some reason. I fixed it by deleting the entry in the corresponding table and since then everything is running as it should. – Greg Feb 20 '18 at 15:09
  • If that helped you resolve the issue please mark the answer as accepted. – Greg Feb 20 '18 at 16:08
  • @BareFeet i have a similar issue here to your one: magento.stackexchange.com/questions/220833/… I was wondering if you could take a look and see if it is acutally the same and shine some light on which table you deleted entries from? – harri Apr 4 '18 at 13:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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