A new day, a new problem. While importing new products in Magento 2.1.2 via System > Data Transfer > Import something was causing the following error message.
1 |
1. Category "Default Category/abc/def/" has not been created. URL key for specified store already exists. in row(s): 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 |
The CSV file was 100% correct, which was making it difficult to figure out why it is causing the error. I ran few more test imports and noticed that the main category actually had an empty space at the end, which I believe was causing the whole problem.
The import ran through without any errors after removing the empty space. However, before I also removed all related URL rewrites as follows. Not sure if this was actually necessary.
1 2 |
mysql> DELETE FROM url_rewrite WHERE entity_type = 'category' AND request_path like '%abc/def/%'; Query OK, 6 rows affected (0.01 sec) |
After that I rebuilt the re-write table with https://github.com/olegkoval/magento2-regenerate_url_rewrites because for some reason the importer didn’t create the rewrite URLs.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
$ php bin/magento ok:urlrewrites:regenerate Regenerating of Url rewrites: [Store ID: 0, Store View code: admin]:.................... .................... .................... .................... .................... .................... .................... .................... .................... .................... ................URL key for specified store already exists. .... .. |
After that everything was working as expected.