Unique constraint violation found - Unable to save new cookie on bin/magento s:up

Magento Asked by Terence Patane-Ronan on December 6, 2020

I just recently switched over to mac for work and am working on getting my local environment set up. Everything’s been going much more smoothly than on my PC with Virtualbox, but when I go running bin/magento setup:upgrade for the first time I get the following error:

Installing data... Unable to save new cookie. Error: Unique constraint violation found

Installing data... Unable to save new cookie. Error: Unique constraint violation found

This is the result of going to magento2.docker/

Unable to run setup:upgrade

I’m running the enterprise cloud 2.3.4 on docker. It seems that this might possibly be the result of duplicate tables. I’m using the exact same DB as I previously was on Ubuntu so unless something corrupted during the transfer I don’t see why it would be an issue with the DB dump. I haven’t run into this error before and unfortunately haven’t found an exact example with the same context as mine, although I’m sure someone here must have an idea. Thanks!

UPDATE (08/03/20):

Running DELETE FROM amasty_gdprcookie_cookie WHERE 1; running bin/magento setup:db-upgrade -vvv to check for errors, then re-running bin/magento setup:upgrade did the trick. Thanks for everyone’s help!

One Answer

I had the same issue. I managed to debug this and I found that the module does not check if the cookies table already has data before inserting the initial cookies.

This happens when you run bin/magento setup:upgrade after you imported a database dump. The solution was to empty the amasty_gdprcookie_cookie table and run again the command.

Have a nice day

Answered by user10508084 on December 6, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP