Skip to content

Magento 2 : When creating a product – Cannot add or update a child row: a foreign key constraint fails?

When creating a product, it throws this error

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails  (`vbm`.`catalog_product_entity`, CONSTRAINT `FK_CAT_PRD_ENTT_ATTR_SET_ID_EAV_ATTR_SET_ATTR_SET_ID` FOREIGN KEY (`attribute_set_id`) REFERENCES `eav_attribute_set` (`attribute_set_id`) ON DELETE), query was: INSERT INTO `catalog_product_entity` (`entity_type_id`, `attribute_set_id`, `type_id`, `sku`, `created_at`, `updated_at`) VALUES (?, ?, ?, ?, '2019-02-13 05:46:17', '2019-02-13 05:46:17')