I'm attempting to reindex my Category Products but i keep getting the following error. I'm can't make heads nor tails of it, any one have any ideas?

Exception message: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (magento.catalog_category_product_index, CONSTRAINT FK_CAT_CTGR_PRD_IDX_CTGR_ID_CAT_CTGR_ENTT_ENTT_ID FOREIGN KEY (category_id) REFERENCES catalog_category_entity (entity_id) ON DEL)


1 Answer 1


One suggestion would be to truncate the table catalog_category_product_index as this will be recreated on index success. It is maybe not the most ideal solution but would hopefully allow for the index to start working again, hopefully this time without any errors.

Normally I would not suggest truncating tables but you should be fairly safe with the index tables, but of course please backup your database and ideally try this on a testing environment first.

  • Had to scrap that database in the end. Backing up is golden advice. Commented Jul 13, 2014 at 16:26

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.