Skip to content

Catalog Layer has been already created error during the search

I am experiencing a very strange issue on Magento (version 2.4).

Due to a mistake, we imported some incorrect products. To rectify this, we reimported the correct ones.

Now, all the products are correct, and the ecommerce works fine but the search function no longer works. When attempting to search for something, an error page is displayed.

enter image description here

I have attempted various solutions, including clearing the cache, reindexing, and so on.

It appears that something is broken, but I am unable to pinpoint the exact issue.

The code has not been modified, and the search function was working before this problem arose.

Here the logs about the issue:

 main.ERROR: Catalog Layer has been already created [] []
main.CRITICAL: RuntimeException: Catalog Layer has been already created in /var/www/magento/vendor/magento/module-catalog/Model/Layer/Resolver.php:54
Stack trace:
#0 /var/www/magento/vendor/magento/module-catalog-search/Controller/Result/Index.php(82): MagentoCatalogModelLayerResolver->create()
#1 /var/www/magento/vendor/magento/framework/Interception/Interceptor.php(58): MagentoCatalogSearchControllerResultIndex->execute()
#2 /var/www/magento/vendor/magento/framework/Interception/Interceptor.php(138): MagentoCatalogSearchControllerResultIndexInterceptor->___callParent()
#3 /var/www/magento/vendor/magento/framework/Interception/Interceptor.php(153): MagentoCatalogSearchControllerResultIndexInterceptor->MagentoFrameworkInterception{closure}()
#4 /var/www/magento/generated/code/Magento/CatalogSearch/Controller/Result/Index/Interceptor.php(23): MagentoCatalogSearchControllerResultIndexInterceptor->___callPlugins()
#5 /var/www/magento/vendor/magento/framework/App/Action/Action.php(111): MagentoCatalogSearchControllerResultIndexInterceptor->execute()
#6 /var/www/magento/vendor/magento/framework/Interception/Interceptor.php(58): MagentoFrameworkAppActionAction->dispatch()
#7 /var/www/magento/vendor/magento/framework/Interception/Interceptor.php(138): MagentoCatalogSearchControllerResultIndexInterceptor->___callParent()
#8 /var/www/magento/vendor/magento/framework/Interception/Interceptor.php(153): MagentoCatalogSearchControllerResultIndexInterceptor->MagentoFrameworkInterception{closure}()
#9 /var/www/magento/generated/code/Magento/CatalogSearch/Controller/Result/Index/Interceptor.php(32): MagentoCatalogSearchControllerResultIndexInterceptor->___callPlugins()
#10 /var/www/magento/vendor/magento/framework/App/FrontController.php(245): MagentoCatalogSearchControllerResultIndexInterceptor->dispatch()
#11 /var/www/magento/vendor/magento/framework/App/FrontController.php(212): MagentoFrameworkAppFrontController->getActionResponse()
#12 /var/www/magento/vendor/magento/framework/App/FrontController.php(147): MagentoFrameworkAppFrontController->processRequest()
#13 /var/www/magento/vendor/magento/framework/Interception/Interceptor.php(58): MagentoFrameworkAppFrontController->dispatch()
#14 /var/www/magento/vendor/magento/framework/Interception/Interceptor.php(138): MagentoFrameworkAppFrontControllerInterceptor->___callParent()
#15 /var/www/magento/vendor/magento/module-store/App/FrontController/Plugin/RequestPreprocessor.php(99): MagentoFrameworkAppFrontControllerInterceptor->MagentoFrameworkInterception{closure}()
#16 /var/www/magento/vendor/magento/framework/Interception/Interceptor.php(135): MagentoStoreAppFrontControllerPluginRequestPreprocessor->aroundDispatch()
#17 /var/www/magento/vendor/amasty/aminvisiblecaptcha/Plugin/Framework/App/FrontControllerInterface/ValidateCaptcha.php(124): MagentoFrameworkAppFrontControllerInterceptor->MagentoFrameworkInterception{closure}()
#18 /var/www/magento/vendor/magento/framework/Interception/Interceptor.php(135): AmastyInvisibleCaptchaPluginFrameworkAppFrontControllerInterfaceValidateCaptcha->aroundDispatch()
#19 /var/www/magento/vendor/magento/module-page-cache/Model/App/FrontController/BuiltinPlugin.php(71): MagentoFrameworkAppFrontControllerInterceptor->MagentoFrameworkInterception{closure}()
#20 /var/www/magento/vendor/magento/framework/Interception/Interceptor.php(135): MagentoPageCacheModelAppFrontControllerBuiltinPlugin->aroundDispatch()
#21 /var/www/magento/vendor/magento/framework/Interception/Interceptor.php(153): MagentoFrameworkAppFrontControllerInterceptor->MagentoFrameworkInterception{closure}()
#22 /var/www/magento/generated/code/Magento/Framework/App/FrontController/Interceptor.php(23): MagentoFrameworkAppFrontControllerInterceptor->___callPlugins()
#23 /var/www/magento/vendor/magento/framework/App/Http.php(116): MagentoFrameworkAppFrontControllerInterceptor->dispatch()
#24 /var/www/magento/vendor/magento/framework/App/Bootstrap.php(264): MagentoFrameworkAppHttp->launch()
#25 /var/www/magento/pub/index.php(30): MagentoFrameworkAppBootstrap->run()

Could it be that something in the database has become corrupted?

Any idea?