so I have a few problems that I want to solve but I can't and I tried everything!

  1. I don't have any root category and I can't create via PHP file don't know why
  2. I can't go to admin>products>categories, it gives me a to many redirects error

Yesterday I had a Root Category...

So I'm kinda scared because I probably deleted the category from the database and now I don't know what to do.

enter image description here

Can someone help?

Thanks in advance

  • You have to enable magento log and check what happen – Amit Bera Sep 14 at 11:04
  • Is it a clean install of magento 2 ? – Sourabh Kumar Sharma Sep 14 at 11:04
  • @SourabhKumarSharma yes – user6505433 Sep 14 at 11:10
  • @AmitBera how do I enable that ? – user6505433 Sep 14 at 11:11
  • @SourabhKumarSharma i added a print – user6505433 Sep 14 at 11:13

since you have deleted the root category i can suggest you a solution. The solution is that create another category at the parent level and then go to Stores > Settings > All Stores select your store from the grid and the form will open , in that select your new category as the root category. If you had sub categories assigned in the root category, drag those categories into this new root category.

From your question what i can assume is that you are saying that root category was deleted automatically, for that you will have to debug the reason because again there are chances that this new root category also can get deleted.

  • How do I create another category at parent level ? – user6505433 Sep 14 at 11:33
  • Yes, because you have already lost the existing root category. – Sourabh Kumar Sharma Sep 14 at 11:33
  • I´m asking how do I do that if i can´t go to the categories page – user6505433 Sep 14 at 11:36
  • Have you deleted anything from the code or installed some third party module ? – Sourabh Kumar Sharma Sep 14 at 11:38
  • If you haven't installed any third party module and have not deleted anything from core code of magento 2, then i will just you to run the below commands: php bin/magento cache:clean php bin/magento setup:upgrade php bin/magento setup:static-content:deploy – Sourabh Kumar Sharma Sep 14 at 11:39

I already solved it !

So I had a database backup !

And I compared some tables and I probably made the mistake to delete some data.

Thanks for your time you all !

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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