magento2: Uncaught Error: Call to a member function setActive

Preconditions

  1. PHP 7.1.11
  2. Nginx 1.13.8
  3. MariaDB 10.2
  4. Magento 2.2.2 CE

Steps to reproduce

  1. Install magento 2.2.2 using the setup wizard
  2. Run command bin/magento setup:di:compile
  3. Go to Admin Address

Expected result

Show Admin login form

Actual result

PHP Fatal error:  Uncaught Error: Call to a member function setActive() on boolean in vendor\magento\module-backend\Model\View\Result\Page.php:27
Stack trace:
#0 vendor\magento\module-backend\Controller\Adminhtml\Dashboard\Index.php(35): Magento\Backend\Model\View\Result\Page->setActiveMenu('Magento_Backend...')
#1 vendor\magento\framework\App\Action\Action.php(107): Magento\Backend\Controller\Adminhtml\Dashboard\Index->execute()
#2 vendor\magento\module-backend\App\AbstractAction.php(229): Magento\Framework\App\Action\Action->dispatch(Object(Magento\Framework\App\Request\Http))
#3 vendor\magento\framework\App\FrontController.php(55): Magento\Backend\App\AbstractAction->dispatch(Object(Magento\Framework\App\Request\Http))
#4 vendor\magento\framework\App\Http.php(135): Magento\Framework\App\FrontController->dispatch(Object(Magento\Framework\App\Request\Http))
#5 C:\WTServer\WWW\ma in vendor\magento\module-backend\Model\View\Result\Page.php on line 27

If I delete the file generated\metadata\global.php , login form is showing.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 2
  • Comments: 22 (6 by maintainers)

Most upvoted comments

I have the same issue. And I can resolve it by doing the same thing. Removing “generated\metadata\global.php” fixes it.

Hello, confirm the same error in magento 2.2.3, working in local with Laragon. Removing “generated\metadata\global.php” fixes it.

I have the same issue. anyone has a solution yet? I don’t think delete global.php is the proper solution?

The same issue on Magento 2.2.5 on windows + wamp after installing first extension. Removing global.php file fixed it.

Hello, i am facing same issue in magento 2.2.4 working in local windows + xampp installation and Removing “generated\metadata\global.php” fixes it.

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

try running php bin/magento setup:di:compile this should solve it . you may need to give the var cache folder the correct permission after this command