I encountered the following issue when i was trying to install a module. When I try to access the admin panel on my magento I get:

Call to a member function setActive() on boolean in C:\xampp\htdocs\project\vendor\magento\module-backend\Model\View\Result\Page.php on line 27

I disabled all third party and custom modules, I compiled the code but I still get this error.

EDIT: I did a var_dump($itemId) just below the line where the error is and the $itemid is 'Magento_Backend::dashboard'.

EDIT 2: The error is because the line "$this->layout->getBlock('menu');" above returns false. I can't find though why this is happening


I will try to this to solve problem if setActive() error() arrived after setup:di:compile then becauese of session is destroy

so go to Magento directory and then delete file genre ted by di:compile is path :-

magento\generated\metadata\global.php delete this file then after refers your page

this is temporary solution for this error in local server.

|improve this answer|||||
  • I already removed it and still not working. – Bhavin Shah Aug 29 '18 at 5:07
  • It actually worked for me, however, is it safe to remove this file? – Greg Dec 8 '18 at 21:00
  • yes it's safe to remove as long as you do a setup:upgrade afterwards – John Jan 21 '19 at 7:27
  • This worked for me. Thanks. – Riddhish Bhayani May 27 '19 at 6:30
  • This worked for me as well. – Magento Learner Feb 6 at 10:42

I had the same situation in the development of own modules (I created/changed layout files for grid in adminhtml). Try to clean cache and switch to development mode:

$ ./bin/magento cache:clean
$ ./bin/magento deploy:mode:set developer

I suppose some cached stuff is not cleaned on cache:clean & setup:di:compile in production mode. You can switch back to production mode back if error will gone in development mode.

|improve this answer|||||
  • I think I did the same thing! It was a layout file issue. Thanks! – Sotiris Oik Feb 7 '18 at 9:06
  • 1
    php bin/magento setup:di:compile - executed this command and resolved my issue – Pandurang Aug 28 '18 at 10:14

Do try to remove pub/static and var/cache then run the below commands

php bin/magento setup:upgrade

php bin/magento setup:static-content:deploy

After that it will work

|improve this answer|||||
  • 1
    @Priyank I was in the same situation, I google it and find that question on google, once I got to resolve the issue, I taught its better to share the solution. Maybe you just dislike because you need some badge or something else. – Noni Oct 23 '18 at 11:55

When you do getBlock() it returns the block or it returns false if it can not find it. You need to have a check in place something like :

$block = $layout->getBlock('name);
If ($block){
//execute the rest

The reason why it can not find your block is something i would need more details for. If you are using a layout xml file be sure that the block and the class of the block does not have any errors.

|improve this answer|||||

The problem is that the layout xml of this controller path is not loading properly.

Check that the name and the namespace of the controller is matching with the layout file name. Take care of the case sensitivity.

For example:

  • custom_module_admin_customcontroller_action.xml
  • namespace Custom\Module\Controller\Adminhtml\Customcontroller and not CustomController
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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