I am getting an error when I am importing simple products in Magento 2.2.

The error is :

  1. Category " has not been created. URL key for specified store already exists. in row(s): 1 General system exception happened Additional data: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`acbwqvzgyr`.`catalog_category_product`, CONSTRAINT `CAT_CTGR_PRD_CTGR_ID_CAT_CTGR_ENTT_ENTT_ID` FOREIGN KEY (`category_id`) REFERENCES `catalog_category_entity` (`entity_id`) ON DELETE CASCAD), query was: INSERT INTO `catalog_category_product` (`product_id`,`category_id`,`position`) VALUES (?, ?, ?), (?, ?, ?) ON DUPLICATE KEY UPDATE `product_id` = VALUES(`product_id`), `category_id` = VALUES(`category_id`)

How can I solve this issue?

  • If your importing multiple products with same name then getting above error. Please remove same name products and try again.
    – Abdul
    Commented Dec 2, 2017 at 12:23

2 Answers 2


It seems that your csv has a new category on category column and it is not able to create category due to duplicate name [which is eventually throwing duplicate url issue].

My suggestion would be first create categories separately and them do product import.

Also you can use api to import data where you can check the duplicate url key before you insert a data.

Let me know if you need help on API code.


In your csv file you have at least one empty cell in the 'categories' column, thus the error message is

Category " has not been created.

Fill in a value and try it again.

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.