SolvedPrestaShop 500 error: Kernel Container is not available

Describe the bug
After a payment (coming back from an external payment site), the payment module I am using calls PaymentModuleCore->validateOrder, which crashes with the exception "Kernel Container is not available".
This has happened since updating from to
It seems ContainerFinder was introduced between those versions


Fatal error: Uncaught Exception: Kernel Container is not available in /opt/bitnami/apps/prestashop/htdocs/src/Adapter/ContainerFinder.php:77 
Stack trace: 
#0 /opt/bitnami/apps/prestashop/htdocs/classes/Tools.php(796): PrestaShop\PrestaShop\Adapter\ContainerFinder->getContainer() 
#1 /opt/bitnami/apps/prestashop/htdocs/classes/Tools.php(773): ToolsCore::getContextLocale(Object(Context)) 
#2 /opt/bitnami/apps/prestashop/htdocs/classes/PaymentModule.php(421): ToolsCore::displayPrice(1.05, Object(Currency), false) 
#3 /opt/bitnami/apps/prestashop/htdocs/modules/sagepay/validation.php(85): PaymentModuleCore->validateOrder(20035, '2', 1.26, 'Sagepay', 'Result:OK<br />...', Array, NULL, false, 'REDACTED') 
#4 {main} thrown in /opt/bitnami/apps/prestashop/htdocs/src/Adapter/ContainerFinder.php on line 77

Additional information
PrestaShop version:
PHP version: 7.1.22

17 Answers

✔️Accepted Answer

Hi @TedEriksson
Checking out the diff for 1.7.6 in the payment module I use (mobilpay), I see they are initializing the kernel in validation.php:

    global $kernel;
      require_once _PS_ROOT_DIR_.'/app/AppKernel.php';
      $kernel = new \AppKernel('prod', false);

Maybe you can implement this behaviour in your module.

More Issues: