Skip to content

Error: Call to a member function getCode() – Magento 2

I am having the following error message in Magento 2

Error: Call to a member function getCode() on null in /vendor/magento/module-store/App/Action/Plugin/Context.php:148 Stack trace: 
#0 /vendor/magento/module-store/App/Action/Plugin/Context.php(100): MagentoStoreAppActionPluginContext->updateContext(Object(MagentoFrameworkAppRequestHttp), Object(MagentoStoreModelStoreInterceptor)) 
#1 /vendor/magento/framework/Interception/Interceptor.php(121): MagentoStoreAppActionPluginContext->beforeDispatch(Object(MagentoCmsControllerIndexIndexInterceptor), Object(MagentoFrameworkAppRequestHttp))

Any suggestion on how to solve this problem?