Magento 2 How to fix resolve Fatal error: Uncaught Error: Call to a member function setActive() on boolean in magento2


Solution and quick fixes for Magento 2 Fatal error: Uncaught Error: Call to a member function setActive() on boolean in magento2

 The following fatal error occurs in the magento 2. system when we are trying to do some changes or add some new functionalities , after adding the new functionality try to run the terminal commands to delete the cache , module upgrade so that the new changes will reflect on the particular store in magento 2
and run the shell commands


 bin/magento setup:di:compile

 bin/magento setup:static-content:deploy




after running the above command the following error occurs in magento2

 Fatal error: Uncaught Error: Call to a member function setActive() on boolean


Solution :

This can be solved by running the following command in your terminal or shell ssh

You need to be the root directory of magento2 installation



rm -r var/genereated/metadata/global.php


the metadata in the var folder is automatically generated, hence you can delete the above path .