Each time i try to add Customizable Options to a product i got this error :

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails
(`thailandnamage`.`catalog_product_option_title`, CONSTRAINT `CAT_PRD_OPT_TTL_OPT_ID_CAT_PRD_OPT_OPT_ID` FOREIGN KEY (`option_id`) REFERENCES `catalog_product_option` (`option_id`) ON DELETE CA),
query was: INSERT INTO `catalog_product_option_title` (`option_id`, `store_id`, `title`) VALUES (?, ?, ?)

Which says that magento cannot add orphan row to catalog_product_option_title, because the option_id don't exist into catalog_product_option but since it is new entry, why it can't add the row on that table first ? If the bug happen since the beginning i would understand, but why this bug start to happen ?

something wrong with the db ?

It start to occurs after i tried to add an article but the page didn't finish the task (504 error).

I have check the db, and it look ok... i even did a backup of the db from date before the bug occurs.

Does anyone know how was to check/fix ?

NB: When i try to import custom option from an other product i got this error (after saving the product):

No such entity.

Thanks !

2 Answers 2


It wasn't coming from the db at all but from a patch i used...


All these bug are a problem for magento. you need to patch the CMS to fix bug, but it creates other bugs... it never end. I am a bit disappointed by magento 2 for that.


I also had this problem. I solved it just by adding a couple of lines of code in

in the save method:

if ($option->getOptionId()) {
} else

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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