Skip to content

Unique constraint violation found – When trying to edit existing item in catalog

Magento 2.4

When I try to edit an item in the catalog I get the error below, the change I made was went from developer to production mode.

I have checked to see that auto increment is on and it is. No where out there on the web can I find a solution.

Upon save I get

Unique constraint violation found

and this is what is in the logfile

[2022-09-26T20:12:21.598696+00:00] main.CRITICAL: Exception message: Unique constraint violation found
Trace: #1 MagentoFrameworkEntityManagerEntityManager->save() called at [vendor/magento/module-catalog/Model/ResourceModel/Product.php:777]
#2 MagentoCatalogModelResourceModelProduct->save() called at [vendor/magento/framework/Interception/Interceptor.php:58]
#3 MagentoCatalogModelResourceModelProductInterceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138]
#4 MagentoCatalogModelResourceModelProductInterceptor->MagentoFrameworkInterception{closure}() called at [vendor/magento/module-catalog-search/Model/Indexer/Fulltext/Plugin/Product.php:58]
#5 MagentoCatalogSearchModelIndexerFulltextPluginProduct->addCommitCallback() called at [vendor/magento/module-catalog-search/Model/Indexer/Fulltext/Plugin/Product.php:28]
#6 MagentoCatalogSearchModelIndexerFulltextPluginProduct->aroundSave() called at [vendor/magento/framework/Interception/Interceptor.php:135]
#7 MagentoCatalogModelResourceModelProductInterceptor->MagentoFrameworkInterception{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#8 MagentoCatalogModelResourceModelProductInterceptor->___callPlugins() called at [generated/code/Magento/Catalog/Model/ResourceModel/Product/Interceptor.php:32]
#9 MagentoCatalogModelResourceModelProductInterceptor->save() called at [vendor/magento/framework/Model/AbstractModel.php:658]
#10 MagentoFrameworkModelAbstractModel->save() called at [generated/code/Magento/Catalog/Model/Product/Interceptor.php:1706]
#11 MagentoCatalogModelProductInterceptor->save() called at [vendor/magento/module-catalog/Controller/Adminhtml/Product/Save.php:143]
#12 MagentoCatalogControllerAdminhtmlProductSave->execute() called at [vendor/magento/framework/Interception/Interceptor.php:58]
#13 MagentoCatalogControllerAdminhtmlProductSaveInterceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138]
#14 MagentoCatalogControllerAdminhtmlProductSaveInterceptor->MagentoFrameworkInterception{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#15 MagentoCatalogControllerAdminhtmlProductSaveInterceptor->___callPlugins() called at [generated/code/Magento/Catalog/Controller/Adminhtml/Product/Save/Interceptor.php:23]
#16 MagentoCatalogControllerAdminhtmlProductSaveInterceptor->execute() called at [vendor/magento/framework/App/Action/Action.php:111]
#17 MagentoFrameworkAppActionAction->dispatch() called at [vendor/magento/module-backend/App/AbstractAction.php:151]
#18 MagentoBackendAppAbstractAction->dispatch() called at [vendor/magento/framework/Interception/Interceptor.php:58]
#19 MagentoCatalogControllerAdminhtmlProductSaveInterceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138]
#20 MagentoCatalogControllerAdminhtmlProductSaveInterceptor->MagentoFrameworkInterception{closure}() called at [vendor/magento/module-backend/App/Action/Plugin/Authentication.php:145]
#21 MagentoBackendAppActionPluginAuthentication->aroundDispatch() called at [vendor/magento/framework/Interception/Interceptor.php:135]
#22 MagentoCatalogControllerAdminhtmlProductSaveInterceptor->MagentoFrameworkInterception{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#23 MagentoCatalogControllerAdminhtmlProductSaveInterceptor->___callPlugins() called at [generated/code/Magento/Catalog/Controller/Adminhtml/Product/Save/Interceptor.php:32]
#24 MagentoCatalogControllerAdminhtmlProductSaveInterceptor->dispatch() called at [vendor/magento/framework/App/FrontController.php:245]
#25 MagentoFrameworkAppFrontController->getActionResponse() called at [vendor/magento/framework/App/FrontController.php:212]
#26 MagentoFrameworkAppFrontController->processRequest() called at [vendor/magento/framework/App/FrontController.php:147]
#27 MagentoFrameworkAppFrontController->dispatch() called at [vendor/magento/framework/Interception/Interceptor.php:58]
#28 MagentoFrameworkAppFrontControllerInterceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138]
#29 MagentoFrameworkAppFrontControllerInterceptor->MagentoFrameworkInterception{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#30 MagentoFrameworkAppFrontControllerInterceptor->___callPlugins() called at [generated/code/Magento/Framework/App/FrontController/Interceptor.php:23]
#31 MagentoFrameworkAppFrontControllerInterceptor->dispatch() called at [vendor/magento/framework/App/Http.php:116]
#32 MagentoFrameworkAppHttp->launch() called at [generated/code/Magento/Framework/App/Http/Interceptor.php:23]
#33 MagentoFrameworkAppHttpInterceptor->launch() called at [vendor/magento/framework/App/Bootstrap.php:264]
#34 MagentoFrameworkAppBootstrap->run() called at [pub/index.php:30]