magento2.4 – ArgumentCountError: Too few arguments to function – Product pages do not work – Magento 2.4


I’ve been having some trouble with M2.4 after an upgrade from 2.3.5.

Getting this error on product pages only, backend and all other pages seem to work fine.

I have used

rm -rf generated

rm -rf var/cache

php bin/magento setup:upgrade

php bin/magento setup:di:compile

php bin/magento setup:static-content:deploy en_GB -f

php bin/magento cache:clean

php bin/magento cache:flush

& nothing helps.

ArgumentCountError: Too few arguments to function MagentoInventoryCatalogPluginCatalogInventoryHelperStockAdaptAssignStatusToProductPlugin::beforeAssignStatusToProduct(), 2 passed in /var/www/html/vendor/magento/framework/Interception/Interceptor.php on line 121 and exactly 3 expected in /var/www/html/vendor/magento/module-inventory-catalog/Plugin/CatalogInventory/Helper/Stock/AdaptAssignStatusToProductPlugin.php:71

Stack trace:
#0 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(121): MagentoInventoryCatalogPluginCatalogInventoryHelperStockAdaptAssignStatusToProductPlugin->beforeAssignStatusToProduct(Object(MagentoCatalogInventoryHelperStockInterceptor), Object(MagentoCatalogModelProductInterceptor))
#1 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(153): MagentoCatalogInventoryHelperStockInterceptor->MagentoFrameworkInterception{closure}(Object(MagentoCatalogModelProductInterceptor))
#2 /var/www/html/generated/code/Magento/CatalogInventory/Helper/Stock/Interceptor.php(26): MagentoCatalogInventoryHelperStockInterceptor->___callPlugins(‘assignStatusToP…’, Array, Array)
#3 /var/www/html/vendor/magento/module-catalog-inventory/Observer/AddInventoryDataObserver.php(37): MagentoCatalogInventoryHelperStockInterceptor->assignStatusToProduct(Object(MagentoCatalogModelProductInterceptor))
#4 /var/www/html/vendor/magento/framework/Event/Invoker/InvokerDefault.php(88): MagentoCatalogInventoryObserverAddInventoryDataObserver->execute(Object(MagentoFrameworkEventObserver))
#5 /var/www/html/vendor/magento/framework/Event/Invoker/InvokerDefault.php(74): MagentoFrameworkEventInvokerInvokerDefault->_callObserverMethod(Object(MagentoCatalogInventoryObserverAddInventoryDataObserver), Object(MagentoFrameworkEventObserver))
#6 /var/www/html/vendor/magento/framework/Event/Manager.php(66): MagentoFrameworkEventInvokerInvokerDefault->dispatch(Array, Object(MagentoFrameworkEventObserver))
#7 /var/www/html/generated/code/Magento/Framework/Event/Manager/Proxy.php(95): MagentoFrameworkEventManager->dispatch(‘catalog_product…’, Array)
#8 /var/www/html/vendor/magento/framework/Model/AbstractModel.php(581): MagentoFrameworkEventManagerProxy->dispatch(‘catalog_product…’, Array)
#9 /var/www/html/vendor/magento/module-catalog/Model/Product.php(1098): MagentoFrameworkModelAbstractModel->_afterLoad()
#10 /var/www/html/vendor/magento/framework/Model/AbstractModel.php(605): MagentoCatalogModelProduct->_afterLoad()
#11 /var/www/html/vendor/magento/framework/EntityManager/Observer/AfterEntityLoad.php(34): MagentoFrameworkModelAbstractModel->afterLoad()
#12 /var/www/html/vendor/magento/framework/Event/Invoker/InvokerDefault.php(88): MagentoFrameworkEntityManagerObserverAfterEntityLoad->execute(Object(MagentoFrameworkEventObserver))
#13 /var/www/html/vendor/magento/framework/Event/Invoker/InvokerDefault.php(74): MagentoFrameworkEventInvokerInvokerDefault->_callObserverMethod(Object(MagentoFrameworkEntityManagerObserverAfterEntityLoad), Object(MagentoFrameworkEventObserver))
#14 /var/www/html/vendor/magento/framework/Event/Manager.php(66): MagentoFrameworkEventInvokerInvokerDefault->dispatch(Array, Object(MagentoFrameworkEventObserver))
#15 /var/www/html/generated/code/Magento/Framework/Event/Manager/Proxy.php(95): MagentoFrameworkEventManager->dispatch(‘magento_catalog…’, Array)
#16 /var/www/html/vendor/magento/framework/EntityManager/EventManager.php(51): MagentoFrameworkEventManagerProxy->dispatch(‘magento_catalog…’, Array)
#17 /var/www/html/vendor/magento/framework/EntityManager/Operation/Read.php(119): MagentoFrameworkEntityManagerEventManager->dispatchEntityEvent(‘MagentoCatalog…’, ‘load_after’, Array)
#18 /var/www/html/vendor/magento/framework/EntityManager/EntityManager.php(70): MagentoFrameworkEntityManagerOperationRead->execute(Object(MagentoCatalogModelProductInterceptor), ’89’, Array)
#19 /var/www/html/vendor/magento/module-catalog/Model/ResourceModel/Product.php(716): MagentoFrameworkEntityManagerEntityManager->load(Object(MagentoCatalogModelProductInterceptor), ’89’)
#20 /var/www/html/vendor/magento/framework/Model/AbstractModel.php(540): MagentoCatalogModelResourceModelProduct->load(Object(MagentoCatalogModelProductInterceptor), ’89’, NULL)
#21 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(58): MagentoFrameworkModelAbstractModel->load(’89’)
#22 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(138): MagentoCatalogModelProductInterceptor->___callParent(‘load’, Array)
#23 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(153): MagentoCatalogModelProductInterceptor->MagentoFrameworkInterception{closure}(’89’)
#24 /var/www/html/generated/code/Magento/Catalog/Model/Product/Interceptor.php(65): MagentoCatalogModelProductInterceptor->___callPlugins(‘load’, Array, Array)
#25 /var/www/html/vendor/magento/module-catalog/Model/ProductRepository.php(308): MagentoCatalogModelProductInterceptor->load(’89’)
#26 /var/www/html/generated/code/Magento/Catalog/Model/ProductRepository/Interceptor.php(37): MagentoCatalogModelProductRepository->getById(’89’, false, NULL, false)
#27 /var/www/html/vendor/magento/module-swatches/Helper/Data.php(270): MagentoCatalogModelProductRepositoryInterceptor->getById(’89’)
#28 /var/www/html/vendor/magento/module-swatches/Block/Product/Renderer/Listing/Configurable.php(228): MagentoSwatchesHelperData->loadVariationByFallback(Object(MagentoCatalogModelProductInterceptor), Array)
#29 /var/www/html/vendor/magento/module-swatches/Block/Product/Renderer/Listing/Configurable.php(205): MagentoSwatchesBlockProductRendererListingConfigurable->getProductVariationWithMedia(Object(MagentoCatalogModelProductInterceptor), Array)
#30 /var/www/html/vendor/magento/module-configurable-product/Block/Product/View/Type/Configurable.php(247): MagentoSwatchesBlockProductRendererListingConfigurable->_getAdditionalConfig()
#31 /var/www/html/vendor/magento/module-swatches/Block/Product/Renderer/Listing/Configurable.php(154): MagentoConfigurableProductBlockProductViewTypeConfigurable->getJsonConfig()
#32 /var/www/html/var/view_preprocessed/pub/static/vendor/magento/module-swatches/view/frontend/templates/product/listing/renderer.phtml(9): MagentoSwatchesBlockProductRendererListingConfigurable->getJsonConfig()
#33 /var/www/html/vendor/magento/framework/View/TemplateEngine/Php.php(71): include(‘/var/www/html/v…’)
#34 /var/www/html/vendor/magento/framework/View/Element/Template.php(273): MagentoFrameworkViewTemplateEnginePhp->render(Object(MagentoSwatchesBlockProductRendererListingConfigurableInterceptor), ‘/var/www/html/v…’, Array)
#35 /var/www/html/vendor/magento/framework/View/Element/Template.php(303): MagentoFrameworkViewElementTemplate->fetchView(‘/var/www/html/v…’)
#36 /var/www/html/vendor/magento/module-swatches/Block/Product/Renderer/Configurable.php(481): MagentoFrameworkViewElementTemplate->_toHtml()
#37 /var/www/html/vendor/magento/module-swatches/Block/Product/Renderer/Configurable.php(459): MagentoSwatchesBlockProductRendererConfigurable->getHtmlOutput()
#38 /var/www/html/vendor/magento/module-swatches/Block/Product/Renderer/Listing/Configurable.php(125): MagentoSwatchesBlockProductRendererConfigurable->_toHtml()
#39 /var/www/html/vendor/magento/framework/View/Element/AbstractBlock.php(1111): MagentoSwatchesBlockProductRendererListingConfigurable->_toHtml()
#40 /var/www/html/vendor/magento/framework/Cache/LockGuardedCacheLoader.php(136): MagentoFrameworkViewElementAbstractBlock->MagentoFrameworkViewElement{closure}()
#41 /var/www/html/vendor/magento/framework/View/Element/AbstractBlock.php(1133): MagentoFrameworkCacheLockGuardedCacheLoader->lockedLoadData(‘BLOCK_fcf09c021…’, Object(Closure), Object(Closure), Object(Closure))
#42 /var/www/html/vendor/magento/framework/View/Element/AbstractBlock.php(675): MagentoFrameworkViewElementAbstractBlock->_loadCache()
#43 /var/www/html/vendor/magento/module-swatches/Block/Product/Renderer/Configurable.php(449): MagentoFrameworkViewElementAbstractBlock->toHtml()
#44 /var/www/html/vendor/magento/module-catalog/Block/Product/AbstractProduct.php(471): MagentoSwatchesBlockProductRendererConfigurable->toHtml()
#45 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(58): MagentoCatalogBlockProductAbstractProduct->getProductDetailsHtml(Object(MagentoCatalogModelProductInterceptor))
#46 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(138): MagentoCatalogBlockProductListProductInterceptor->___callParent(‘getProductDetai…’, Array)
#47 /var/www/html/vendor/paypal/module-braintree-core/Plugin/ProductDetailsBlockPlugin.php(37): MagentoCatalogBlockProductListProductInterceptor->MagentoFrameworkInterception{closure}(Object(MagentoCatalogModelProductInterceptor))
#48 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(135): PayPalBraintreePluginProductDetailsBlockPlugin->aroundGetProductDetailsHtml(Object(MagentoCatalogBlockProductListProductInterceptor), Object(Closure), Object(MagentoCatalogModelProductInterceptor))
#49 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(153): MagentoCatalogBlockProductListProductInterceptor->MagentoFrameworkInterception{closure}(Object(MagentoCatalogModelProductInterceptor))
#50 /var/www/html/generated/code/Magento/Catalog/Block/Product/ListProduct/Interceptor.php(26): MagentoCatalogBlockProductListProductInterceptor->___callPlugins(‘getProductDetai…’, Array, NULL)
#51 /var/www/html/var/view_preprocessed/pub/static/vendor/magento/module-catalog/view/frontend/templates/product/list.phtml(1): MagentoCatalogBlockProductListProductInterceptor->getProductDetailsHtml(Object(MagentoCatalogModelProductInterceptor))
#52 /var/www/html/vendor/magento/framework/View/TemplateEngine/Php.php(71): include(‘/var/www/html/v…’)
#53 /var/www/html/vendor/magento/framework/View/Element/Template.php(273): MagentoFrameworkViewTemplateEnginePhp->render(Object(MagentoCatalogBlockProductListProductInterceptor), ‘/var/www/html/v…’, Array)
#54 /var/www/html/vendor/magento/framework/View/Element/Template.php(303): MagentoFrameworkViewElementTemplate->fetchView(‘/var/www/html/v…’)
#55 /var/www/html/vendor/magento/framework/View/Element/AbstractBlock.php(1111): MagentoFrameworkViewElementTemplate->_toHtml()
#56 /var/www/html/vendor/magento/framework/View/Element/AbstractBlock.php(1115): MagentoFrameworkViewElementAbstractBlock->MagentoFrameworkViewElement{closure}()
#57 /var/www/html/vendor/magento/framework/View/Element/AbstractBlock.php(675): MagentoFrameworkViewElementAbstractBlock->_loadCache()
#58 /var/www/html/vendor/magento/framework/View/Layout.php(566): MagentoFrameworkViewElementAbstractBlock->toHtml()
#59 /var/www/html/vendor/magento/framework/View/Layout.php(542): MagentoFrameworkViewLayout->_renderBlock(‘category.produc…’)
#60 /var/www/html/generated/code/Magento/Framework/View/Layout/Interceptor.php(206): MagentoFrameworkViewLayout->renderNonCachedElement(‘category.produc…’)
#61 /var/www/html/vendor/magento/framework/View/Layout.php(497): MagentoFrameworkViewLayoutInterceptor->renderNonCachedElement(‘category.produc…’)
#62 /var/www/html/generated/code/Magento/Framework/View/Layout/Interceptor.php(193): MagentoFrameworkViewLayout->renderElement(‘category.produc…’, true)
#63 /var/www/html/vendor/magento/framework/View/Element/AbstractBlock.php(522): MagentoFrameworkViewLayoutInterceptor->renderElement(‘category.produc…’, true)
#64 /var/www/html/vendor/magento/module-catalog/Block/Category/View.php(100): MagentoFrameworkViewElementAbstractBlock->getChildHtml(‘product_list’)
#65 /var/www/html/var/view_preprocessed/pub/static/vendor/magento/module-catalog/view/frontend/templates/category/products.phtml(1): MagentoCatalogBlockCategoryView->getProductListHtml()
#66 /var/www/html/vendor/magento/framework/View/TemplateEngine/Php.php(71): include(‘/var/www/html/v…’)
#67 /var/www/html/vendor/magento/framework/View/Element/Template.php(273): MagentoFrameworkViewTemplateEnginePhp->render(Object(MagentoCatalogBlockCategoryView), ‘/var/www/html/v…’, Array)
#68 /var/www/html/vendor/magento/framework/View/Element/Template.php(303): MagentoFrameworkViewElementTemplate->fetchView(‘/var/www/html/v…’)
#69 /var/www/html/vendor/magento/framework/View/Element/AbstractBlock.php(1111): MagentoFrameworkViewElementTemplate->_toHtml()
#70 /var/www/html/vendor/magento/framework/View/Element/AbstractBlock.php(1115): MagentoFrameworkViewElementAbstractBlock->MagentoFrameworkViewElement{closure}()
#71 /var/www/html/vendor/magento/framework/View/Element/AbstractBlock.php(675): MagentoFrameworkViewElementAbstractBlock->_loadCache()
#72 /var/www/html/vendor/magento/framework/View/Layout.php(566): MagentoFrameworkViewElementAbstractBlock->toHtml()
#73 /var/www/html/vendor/magento/framework/View/Layout.php(542): MagentoFrameworkViewLayout->_renderBlock(‘category.produc…’)
#74 /var/www/html/generated/code/Magento/Framework/View/Layout/Interceptor.php(206): MagentoFrameworkViewLayout->renderNonCachedElement(‘category.produc…’)
#75 /var/www/html/vendor/magento/framework/View/Layout.php(497): MagentoFrameworkViewLayoutInterceptor->renderNonCachedElement(‘category.produc…’)
#76 /var/www/html/generated/code/Magento/Framework/View/Layout/Interceptor.php(193): MagentoFrameworkViewLayout->renderElement(‘category.produc…’, false)
#77 /var/www/html/vendor/magento/framework/View/Layout.php(594): MagentoFrameworkViewLayoutInterceptor->renderElement(‘category.produc…’, false)
#78 /var/www/html/vendor/magento/framework/View/Layout.php(544): MagentoFrameworkViewLayout->_renderContainer(‘content’, false)
#79 /var/www/html/generated/code/Magento/Framework/View/Layout/Interceptor.php(206): MagentoFrameworkViewLayout->renderNonCachedElement(‘content’)
#80 /var/www/html/vendor/magento/framework/View/Layout.php(497): MagentoFrameworkViewLayoutInterceptor->renderNonCachedElement(‘content’)
#81 /var/www/html/generated/code/Magento/Framework/View/Layout/Interceptor.php(193): MagentoFrameworkViewLayout->renderElement(‘content’, false)
#82 /var/www/html/vendor/magento/framework/View/Layout.php(594): MagentoFrameworkViewLayoutInterceptor->renderElement(‘content’, false)
#83 /var/www/html/vendor/magento/framework/View/Layout.php(544): MagentoFrameworkViewLayout->_renderContainer(‘main’, false)
#84 /var/www/html/generated/code/Magento/Framework/View/Layout/Interceptor.php(206): MagentoFrameworkViewLayout->renderNonCachedElement(‘main’)
#85 /var/www/html/vendor/magento/framework/View/Layout.php(497): MagentoFrameworkViewLayoutInterceptor->renderNonCachedElement(‘main’)
#86 /var/www/html/generated/code/Magento/Framework/View/Layout/Interceptor.php(193): MagentoFrameworkViewLayout->renderElement(‘main’, false)
#87 /var/www/html/vendor/magento/framework/View/Layout.php(594): MagentoFrameworkViewLayoutInterceptor->renderElement(‘main’, false)
#88 /var/www/html/vendor/magento/framework/View/Layout.php(544): MagentoFrameworkViewLayout->_renderContainer(‘columns’, false)
#89 /var/www/html/generated/code/Magento/Framework/View/Layout/Interceptor.php(206): MagentoFrameworkViewLayout->renderNonCachedElement(‘columns’)
#90 /var/www/html/vendor/magento/framework/View/Layout.php(497): MagentoFrameworkViewLayoutInterceptor->renderNonCachedElement(‘columns’)
#91 /var/www/html/generated/code/Magento/Framework/View/Layout/Interceptor.php(193): MagentoFrameworkViewLayout->renderElement(‘columns’, false)
#92 /var/www/html/vendor/magento/framework/View/Layout.php(594): MagentoFrameworkViewLayoutInterceptor->renderElement(‘columns’, false)
#93 /var/www/html/vendor/magento/framework/View/Layout.php(544): MagentoFrameworkViewLayout->_renderContainer(‘main.content’, false)
#94 /var/www/html/generated/code/Magento/Framework/View/Layout/Interceptor.php(206): MagentoFrameworkViewLayout->renderNonCachedElement(‘main.content’)
#95 /var/www/html/vendor/magento/framework/View/Layout.php(497): MagentoFrameworkViewLayoutInterceptor->renderNonCachedElement(‘main.content’)
#96 /var/www/html/generated/code/Magento/Framework/View/Layout/Interceptor.php(193): MagentoFrameworkViewLayout->renderElement(‘main.content’, false)
#97 /var/www/html/vendor/magento/framework/View/Layout.php(594): MagentoFrameworkViewLayoutInterceptor->renderElement(‘main.content’, false)
#98 /var/www/html/vendor/magento/framework/View/Layout.php(544): MagentoFrameworkViewLayout->_renderContainer(‘page.wrapper’, false)
#99 /var/www/html/generated/code/Magento/Framework/View/Layout/Interceptor.php(206): MagentoFrameworkViewLayout->renderNonCachedElement(‘page.wrapper’)
#100 /var/www/html/vendor/magento/framework/View/Layout.php(497): MagentoFrameworkViewLayoutInterceptor->renderNonCachedElement(‘page.wrapper’)
#101 /var/www/html/generated/code/Magento/Framework/View/Layout/Interceptor.php(193): MagentoFrameworkViewLayout->renderElement(‘page.wrapper’, false)
#102 /var/www/html/vendor/magento/framework/View/Layout.php(594): MagentoFrameworkViewLayoutInterceptor->renderElement(‘page.wrapper’, false)
#103 /var/www/html/vendor/magento/framework/View/Layout.php(544): MagentoFrameworkViewLayout->_renderContainer(‘root’, false)
#104 /var/www/html/generated/code/Magento/Framework/View/Layout/Interceptor.php(206): MagentoFrameworkViewLayout->renderNonCachedElement(‘root’)
#105 /var/www/html/vendor/magento/framework/View/Layout.php(497): MagentoFrameworkViewLayoutInterceptor->renderNonCachedElement(‘root’)
#106 /var/www/html/generated/code/Magento/Framework/View/Layout/Interceptor.php(193): MagentoFrameworkViewLayout->renderElement(‘root’, true)
#107 /var/www/html/vendor/magento/framework/View/Layout.php(963): MagentoFrameworkViewLayoutInterceptor->renderElement(‘root’)
#108 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(58): MagentoFrameworkViewLayout->getOutput()
#109 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(138): MagentoFrameworkViewLayoutInterceptor->___callParent(‘getOutput’, Array)
#110 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(153): MagentoFrameworkViewLayoutInterceptor->MagentoFrameworkInterception{closure}()
#111 /var/www/html/generated/code/Magento/Framework/View/Layout/Interceptor.php(494): MagentoFrameworkViewLayoutInterceptor->___callPlugins(‘getOutput’, Array, Array)
#112 /var/www/html/vendor/magento/framework/View/Result/Page.php(258): MagentoFrameworkViewLayoutInterceptor->getOutput()
#113 /var/www/html/vendor/magento/framework/View/Result/Layout.php(171): MagentoFrameworkViewResultPage->render(Object(MagentoFrameworkAppResponseHttpInterceptor))
#114 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(58): MagentoFrameworkViewResultLayout->renderResult(Object(MagentoFrameworkAppResponseHttpInterceptor))
#115 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(138): MagentoFrameworkViewResultPageInterceptor->___callParent(‘renderResult’, Array)
#116 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(153): MagentoFrameworkViewResultPageInterceptor->MagentoFrameworkInterception{closure}(Object(MagentoFrameworkAppResponseHttpInterceptor))
#117 /var/www/html/generated/code/Magento/Framework/View/Result/Page/Interceptor.php(26): MagentoFrameworkViewResultPageInterceptor->___callPlugins(‘renderResult’, Array, Array)
#118 /var/www/html/vendor/magento/framework/App/Http.php(120): MagentoFrameworkViewResultPageInterceptor->renderResult(Object(MagentoFrameworkAppResponseHttpInterceptor))
#119 /var/www/html/generated/code/Magento/Framework/App/Http/Interceptor.php(24): MagentoFrameworkAppHttp->launch()
#120 /var/www/html/vendor/magento/framework/App/Bootstrap.php(263): MagentoFrameworkAppHttpInterceptor->launch()
#121 /var/www/html/index.php(39): MagentoFrameworkAppBootstrap->run(Object(MagentoFrameworkAppHttpInterceptor))
#122 {main} () ()

I’ve checked file permissions, all owned by the ‘magento_user’ who is a member of the www-data group, all files set to 755/644 according to the doc’s. Turned dev mode off & on again, cleared cache, recompiled etc but still the product page throws up this error, anyone have an idea?

Using debian 10, php7.4 (but happens with 7.3 too), elastic search seems to be installed ok & shows v7 when asked, I’m at a loss now 🙁