Fatal error: Uncaught Error: Cannot instantiate interface Magento\Framework\App\ExceptionHandlerInterface

Environment:

  • PHP 7.2
  • Magento 2.3.4

1. The error

Fatal error: Uncaught Error: Cannot instantiate interface Magento\Framework\App\ExceptionHandlerInterface in /var/www/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:50 Stack trace: #0 /var/www/vendor/magento/framework/ObjectManager/ObjectManager.php(70): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create(‘Magento\\Framewo…’) #1 /var/www/vendor/magento/framework/App/Http.php(100): Magento\Framework\ObjectManager\ObjectManager->get(‘Magento\\Framewo…’) #2 /var/www/generated/code/Magento/Framework/App/Http/Interceptor.php(14): Magento\Framework\App\Http->__construct(Object(Magento\Framework\App\ObjectManager), Object(Magento\Framework\Event\Manager), Object(Magento\Framework\App\AreaList), Object(Magento\Framework\App\Request\Http), Object(Magento\Framework\App\Response\Http\Interceptor), Object(Magento\Framework\App\ObjectManager\ConfigLoader), Object(Magento\Framework\App\State), Object(Magento\Framework\Registry), NULL) #3 /var/www/vendor/magento/framework/ObjectManager/Factory/Abs in /var/www/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php on line 50

This error is caused by missing abstraction-implementation mapping in app/etc/di.xml.

2. Added this line to app/etc/di.xml

3. Another error is shown

Fatal error: Uncaught Error: Cannot instantiate interface Magento\Framework\Filter\VariableResolverInterface in /var/www/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:50 Stack trace: #0 /var/www/vendor/magento/framework/ObjectManager/ObjectManager.php(70): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create(‘Magento\\Framewo…’) #1 /var/www/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(167): Magento\Framework\ObjectManager\ObjectManager->get(‘Magento\\Framewo…’) #2 /var/www/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(273): Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgument(Array, ‘Magento\\Framewo…’, NULL, ‘variableResolve…’, ‘Magento\\Framewo…’) #3 /var/www/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(236): Magento\Framework\ObjectManager\Factory\AbstractFactory->getResolvedArgument(‘Magento\\Framewo…’, Array, Array) #4 /var/www/vendor/magento/framework/ObjectManager/Factory/Dynamic/Deve in /var/www/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php on line 50

This is different from the error above because there are 3 types of VariableResolver:

  1. Magento\Framework\Filter\VariableResolver\LegacyResolver
  2. Magento\Framework\Filter\VariableResolver\StrategyResolver
  3. Magento\Framework\Filter\VariableResolver\StrictResolver

I don’t know what type should be mapped to VariableResolverInterface. Luckily I found the answer from this Github issue, it’s StrategyResolver.

4. Added this line to app/etc/di.xml

and the issue is fixed.

Leave a Reply

avatar
  Subscribe  
Notify of