Skip to content

Magento 2.4.7-p3 no such entity with cartId =

Suddenly started this strange and I can’t figure out what is going on. Exception log is having every hour 3-4 errors in every minute like this:

2024-11-19T15:04:31.199036+00:00] main.CRITICAL: MagentoFrameworkExceptionNoSuchEntityException: No such entity with cartId =  in /home/public_html/vendor/magento/framework/Exception/NoSuchEntityException.php:50
Stack trace:
#0 /home/public_html/vendor/magento/module-quote/Model/QuoteRepository.php(250): MagentoFrameworkExceptionNoSuchEntityException::singleField()
#1 /home/public_html/vendor/magento/module-quote/Model/QuoteRepository.php(149): MagentoQuoteModelQuoteRepository->loadQuote()
#2 /home/public_html/vendor/magento/framework/Interception/Interceptor.php(58): MagentoQuoteModelQuoteRepository->get()
#3 /home/public_html/vendor/magento/framework/Interception/Interceptor.php(138): MagentoQuoteModelQuoteRepositoryInterceptor->___callParent()
#4 /home/public_html/vendor/magento/framework/Interception/Interceptor.php(153): MagentoQuoteModelQuoteRepositoryInterceptor->MagentoFrameworkInterception{closure}()
#5 /home/public_html/generated/code/Magento/Quote/Model/QuoteRepository/Interceptor.php(23): MagentoQuoteModelQuoteRepositoryInterceptor->___callPlugins()
#6 /home/public_html/vendor/magento/module-quote/Model/QuoteRepository.php(181): MagentoQuoteModelQuoteRepositoryInterceptor->get()
#7 /home/public_html/generated/code/Magento/Quote/Model/QuoteRepository/Interceptor.php(32): MagentoQuoteModelQuoteRepository->getActive()
#8 /home/public_html/vendor/magento/module-quote/Model/Quote/Item/Repository.php(79): MagentoQuoteModelQuoteRepositoryInterceptor->getActive()
#9 /home/public_html/vendor/magento/module-checkout/Model/Cart/ImageProvider.php(76): MagentoQuoteModelQuoteItemRepository->getList()
#10 /home/public_html/vendor/magento/framework/Interception/Interceptor.php(58): MagentoCheckoutModelCartImageProvider->getImages()
#11 /home/public_html/vendor/magento/framework/Interception/Interceptor.php(138): MagentoCheckoutModelCartImageProviderInterceptor->___callParent()
#12 /home/public_html/vendor/magento/framework/Interception/Interceptor.php(153): MagentoCheckoutModelCartImageProviderInterceptor->MagentoFrameworkInterception{closure}()
#13 /home/public_html/generated/code/Magento/Checkout/Model/Cart/ImageProvider/Interceptor.php(23): MagentoCheckoutModelCartImageProviderInterceptor->___callPlugins()
#14 /home/public_html/vendor/magento/module-checkout/Model/DefaultConfigProvider.php(347): MagentoCheckoutModelCartImageProviderInterceptor->getImages()
#15 /home/public_html/vendor/magento/framework/Interception/Interceptor.php(58): MagentoCheckoutModelDefaultConfigProvider->getConfig()
#16 /home/public_html/vendor/magento/framework/Interception/Interceptor.php(138): MagentoCheckoutModelDefaultConfigProviderInterceptor->___callParent()
#17 /home/public_html/vendor/magento/framework/Interception/Interceptor.php(153): MagentoCheckoutModelDefaultConfigProviderInterceptor->MagentoFrameworkInterception{closure}()
#18 /home/public_html/generated/code/Magento/Checkout/Model/DefaultConfigProvider/Interceptor.php(23): MagentoCheckoutModelDefaultConfigProviderInterceptor->___callPlugins()
#19 /home/public_html/vendor/magento/module-checkout/Model/CompositeConfigProvider.php(39): MagentoCheckoutModelDefaultConfigProviderInterceptor->getConfig()
#20 /home/public_html/vendor/magento/module-payment-services-paypal/Block/SmartButtons.php(184): MagentoCheckoutModelCompositeConfigProvider->getConfig()
#21 /home/public_html/vendor/magento/module-payment-services-paypal/view/frontend/templates/smart_buttons_minicart.phtml(16): MagentoPaymentServicesPaypalBlockSmartButtons->getSerializedCheckoutConfig()
#22 /home/public_html/vendor/magento/framework/View/TemplateEngine/Php.php(67): include('...')
#23 /home/public_html/vendor/magento/framework/Interception/Interceptor.php(58): MagentoFrameworkViewTemplateEnginePhp->render()
#24 /home/public_html/vendor/magento/framework/Interception/Interceptor.php(138): MagentoFrameworkViewTemplateEnginePhpInterceptor->___callParent()
#25 /home/public_html/vendor/magento/framework/Interception/Interceptor.php(153): MagentoFrameworkViewTemplateEnginePhpInterceptor->MagentoFrameworkInterception{closure}()
#26 /home/public_html/generated/code/Magento/Framework/View/TemplateEngine/Php/Interceptor.php(23): MagentoFrameworkViewTemplateEnginePhpInterceptor->___callPlugins()
#27 /home/public_html/vendor/magento/framework/View/Element/Template.php(263): MagentoFrameworkViewTemplateEnginePhpInterceptor->render()
#28 /home/public_html/vendor/magento/framework/View/Element/Template.php(293): MagentoFrameworkViewElementTemplate->fetchView()
#29 /home/public_html/vendor/magento/framework/View/Element/AbstractBlock.php(1128): MagentoFrameworkViewElementTemplate->_toHtml()
#30 /home/public_html/vendor/magento/framework/View/Element/AbstractBlock.php(1132): MagentoFrameworkViewElementAbstractBlock->MagentoFrameworkViewElement{closure}()
#31 /home/public_html/vendor/magento/framework/View/Element/AbstractBlock.php(676): MagentoFrameworkViewElementAbstractBlock->_loadCache()
#32 /home/public_html/vendor/magento/framework/View/Layout.php(578): MagentoFrameworkViewElementAbstractBlock->toHtml()
#33 /home/public_html/vendor/magento/framework/View/Layout.php(555): MagentoFrameworkViewLayout->_renderBlock()
#34 /home/public_html/vendor/magento/framework/View/Layout.php(510): MagentoFrameworkViewLayout->renderNonCachedElement()
#35 /home/public_html/vendor/magento/framework/Interception/Interceptor.php(58): MagentoFrameworkViewLayout->renderElement()
#36 /home/public_html/vendor/magento/framework/Interception/Interceptor.php(138): MagentoFrameworkViewLayoutInterceptor->___callParent()
#37 /home/public_html/vendor/magento/framework/Interception/Interceptor.php(153): MagentoFrameworkViewLayoutInterceptor->MagentoFrameworkInterception{closure}()
#38 /home/public_html/generated/code/Magento/Framework/View/Layout/Interceptor.php(41): MagentoFrameworkViewLayoutInterceptor->___callPlugins()
#39 /home/public_html/vendor/magento/framework/View/Element/AbstractBlock.php(527): MagentoFrameworkViewLayoutInterceptor->renderElement()
#40 /home/public_html/vendor/magento/module-catalog/Block/ShortcutButtons.php(100): MagentoFrameworkViewElementAbstractBlock->getChildHtml()
#41 /home/public_html/vendor/magento/framework/View/Element/AbstractBlock.php(1128): MagentoCatalogBlockShortcutButtons->_toHtml()
#42 /home/public_html/vendor/magento/framework/View/Element/AbstractBlock.php(1132): MagentoFrameworkViewElementAbstractBlock->MagentoFrameworkViewElement{closure}()
#43 /home/public_html/vendor/magento/framework/View/Element/AbstractBlock.php(676): MagentoFrameworkViewElementAbstractBlock->_loadCache()
#44 /home/public_html/vendor/magento/module-checkout/CustomerData/Cart.php(101): MagentoFrameworkViewElementAbstractBlock->toHtml()
#45 /home/public_html/vendor/magento/framework/Interception/Interceptor.php(58): MagentoCheckoutCustomerDataCart->getSectionData()
#46 /home/public_html/vendor/magento/framework/Interception/Interceptor.php(138): MagentoCheckoutCustomerDataCartInterceptor->___callParent()
#47 /home/public_html/vendor/magento/framework/Interception/Interceptor.php(153): MagentoCheckoutCustomerDataCartInterceptor->MagentoFrameworkInterception{closure}()
#48 /home/public_html/generated/code/Magento/Checkout/CustomerData/Cart/Interceptor.php(23): MagentoCheckoutCustomerDataCartInterceptor->___callPlugins()
#49 /home/public_html/vendor/magento/module-customer/CustomerData/SectionPool.php(90): MagentoCheckoutCustomerDataCartInterceptor->getSectionData()
#50 /home/public_html/vendor/magento/module-customer/CustomerData/SectionPool.php(60): MagentoCustomerCustomerDataSectionPool->getSectionDataByNames()
#51 /home/public_html/vendor/magento/module-customer/Controller/Section/Load.php(81): MagentoCustomerCustomerDataSectionPool->getSectionsData()
#52 /home/public_html/vendor/magento/framework/Interception/Interceptor.php(58): MagentoCustomerControllerSectionLoad->execute()
#53 /home/public_html/vendor/magento/framework/Interception/Interceptor.php(138): MagentoCustomerControllerSectionLoadInterceptor->___callParent()
#54 /home/public_html/vendor/magento/framework/Interception/Interceptor.php(153): MagentoCustomerControllerSectionLoadInterceptor->MagentoFrameworkInterception{closure}()
#55 /home/public_html/generated/code/Magento/Customer/Controller/Section/Load/Interceptor.php(23): MagentoCustomerControllerSectionLoadInterceptor->___callPlugins()
#56 /home/public_html/vendor/magento/framework/App/Action/Action.php(111): MagentoCustomerControllerSectionLoadInterceptor->execute()
#57 /home/public_html/vendor/magento/framework/Interception/Interceptor.php(58): MagentoFrameworkAppActionAction->dispatch()
#58 /home/public_html/vendor/magento/framework/Interception/Interceptor.php(138): MagentoCustomerControllerSectionLoadInterceptor->___callParent()
#59 /home/public_html/vendor/magento/framework/Interception/Interceptor.php(153): MagentoCustomerControllerSectionLoadInterceptor->MagentoFrameworkInterception{closure}()
#60 /home/public_html/generated/code/Magento/Customer/Controller/Section/Load/Interceptor.php(32): MagentoCustomerControllerSectionLoadInterceptor->___callPlugins()
#61 /home/public_html/vendor/magento/framework/App/FrontController.php(245): MagentoCustomerControllerSectionLoadInterceptor->dispatch()
#62 /home/public_html/vendor/magento/framework/App/FrontController.php(212): MagentoFrameworkAppFrontController->getActionResponse()
#63 /home/public_html/vendor/magento/framework/App/FrontController.php(146): MagentoFrameworkAppFrontController->processRequest()
#64 /home/public_html/vendor/magento/framework/Interception/Interceptor.php(58): MagentoFrameworkAppFrontController->dispatch()
#65 /home/public_html/vendor/magento/framework/Interception/Interceptor.php(138): MagentoFrameworkAppFrontControllerInterceptor->___callParent()
#66 /home/public_html/vendor/magento/module-store/App/FrontController/Plugin/RequestPreprocessor.php(99): MagentoFrameworkAppFrontControllerInterceptor->MagentoFrameworkInterception{closure}()
#67 /home/public_html/vendor/magento/framework/Interception/Interceptor.php(135): MagentoStoreAppFrontControllerPluginRequestPreprocessor->aroundDispatch()
#68 /home/public_html/vendor/amasty/aminvisiblecaptcha/Plugin/Framework/App/FrontControllerInterface/ValidateCaptcha.php(124): MagentoFrameworkAppFrontControllerInterceptor->MagentoFrameworkInterception{closure}()
#69 /home/public_html/vendor/magento/framework/Interception/Interceptor.php(135): AmastyInvisibleCaptchaPluginFrameworkAppFrontControllerInterfaceValidateCaptcha->aroundDispatch()
#70 /home/public_html/vendor/mirasvit/module-cache-warmer/src/CacheWarmer/Plugin/Debug/OnHitPlugin.php(145): MagentoFrameworkAppFrontControllerInterceptor->MagentoFrameworkInterception{closure}()
#71 /home/public_html/vendor/magento/framework/Interception/Interceptor.php(135): MirasvitCacheWarmerPluginDebugOnHitPlugin->aroundAroundDispatch()
#72 /home/public_html/vendor/magento/framework/Interception/Interceptor.php(153): MagentoPageCacheModelAppFrontControllerBuiltinPluginInterceptor->MagentoFrameworkInterception{closure}()
#73 /home/public_html/generated/code/Magento/PageCache/Model/App/FrontController/BuiltinPlugin/Interceptor.php(23): MagentoPageCacheModelAppFrontControllerBuiltinPluginInterceptor->___callPlugins()
#74 /home/public_html/vendor/magento/framework/Interception/Interceptor.php(135): MagentoPageCacheModelAppFrontControllerBuiltinPluginInterceptor->aroundDispatch()
#75 /home/public_html/vendor/magento/framework/Interception/Interceptor.php(153): MagentoFrameworkAppFrontControllerInterceptor->MagentoFrameworkInterception{closure}()
#76 /home/public_html/generated/code/Magento/Framework/App/FrontController/Interceptor.php(23): MagentoFrameworkAppFrontControllerInterceptor->___callPlugins()
#77 /home/public_html/vendor/magento/framework/App/Http.php(116): MagentoFrameworkAppFrontControllerInterceptor->dispatch()
#78 /home/public_html/vendor/magento/framework/App/Bootstrap.php(264): MagentoFrameworkAppHttp->launch()
#79 /home/public_html/pub/index.php(30): MagentoFrameworkAppBootstrap->run()
#80 {main} {"exception":"[object] (Magento\Framework\Exception\NoSuchEntityException(code: 0): No such entity with cartId =  at /home/public_html/vendor/magento/framework/Exception/NoSuchEntityException.php:50)"} []

This is there for 4 times and then stops. Then again.

My setup is with redis for sessions and for magento cache (not FPC). Also redis is used from php8.3 to save sessions.

Magento cookie settings are these:

cookie settings

and there is no session validation. Ajax cart is used with popup. Tried module from 3-4 major companies. Issue only stops when Ajax cart is disabled
Google tag manager also is used.

This is my env.php file:

<?php
return [
    'backend' => [
        'frontName' => 'admin'
    ],
    'db' => [
        'connection' => [
            'indexer' => [
                'host' => 'localhost',
                'dbname' => 'magento',
                'username' => 'magento',
                'password' => '000000000000',
                'active' => '1',
                'persistent' => null,
                'model' => 'mysql4',
                'engine' => 'innodb',
                'initStatements' => 'SET NAMES utf8;'
            ],
            'default' => [
                'host' => 'localhost',
                'dbname' => 'magento',
                'username' => 'magento',
                'password' => '00000000000000',
                'active' => '1',
                'model' => 'mysql4',
                'engine' => 'innodb',
                'initStatements' => 'SET NAMES utf8;',
                'driver_options' => [
                    1014 => false
                ]
            ]
        ],
        'table_prefix' => ''
    ],
    'crypt' => [
        'key' => '0000000000000000000000000000000000000'
    ],
    'resource' => [
        'default_setup' => [
            'connection' => 'default'
        ]
    ],
    'cache_types' => [
        'config' => 1,
        'layout' => 1,
        'block_html' => 1,
        'collections' => 1,
        'reflection' => 1,
        'db_ddl' => 1,
        'eav' => 1,
        'customer_notification' => 1,
        'config_integration' => 1,
        'config_integration_api' => 1,
        'target_rule' => 1,
        'full_page' => 1,
        'translate' => 1,
        'config_webservice' => 1,
        'compiled_config' => 1,
        'amasty_shopby' => 1,
        'graphql_query_resolver_result' => 1,
        'admin_ui_sdk' => 1
    ],
    'install' => [
        'date' => 'Mon, 11 Feb 2019 15:25:42 +0000'
    ],
    'system' => [
        'default' => [
            'dev' => [
                'debug' => [
                    'debug_logging' => '0'
                ]
            ]
        ]
    ],
    'MAGE_MODE' => 'production',
    'x-frame-options' => 'SAMEORIGIN',
    'session' => [
        'save' => 'redis',
        'redis' => [
            'host' => '/var/run/redis/redis.sock',
            'port' => '0',
            'password' => '',
            'timeout' => '2.5',
            'persistent_identifier' => '',
            'database' => '2',
            'compression_threshold' => '2048',
            'compression_library' => 'gzip',
            'log_level' => '1',
            'max_concurrency' => '100',
            'break_after_frontend' => '5',
            'break_after_adminhtml' => '30',
            'first_lifetime' => '600',
            'bot_first_lifetime' => '60',
            'bot_lifetime' => '7200',
            'disable_locking' => '0',
            'min_lifetime' => '60',
            'max_lifetime' => '2592000',
            'sentinel_master' => '',
            'sentinel_servers' => '',
            'sentinel_connect_retries' => '5',
            'sentinel_verify_master' => '0'
        ]
    ],
    'cache' => [
        'frontend' => [
            'default' => [
                'backend' => '\Magento\Framework\Cache\Backend\RemoteSynchronizedCache',
                'backend_options' => [
                    'remote_backend' => '\Magento\Framework\Cache\Backend\Redis',
                    'remote_backend_options' => [
                        'persistent' => 0,
                        'server' => '/var/run/redis/redis.sock',
                        'database' => '0',
                        'port' => '0',
                        'password' => '',
                        'compress_data' => '1',
                        'preload_keys' => [
                            '358_EAV_ENTITY_TYPES',
                            '358_GLOBAL_PLUGIN_LIST',
                            '358_DB_IS_UP_TO_DATE',
                            '358_SYSTEM_DEFAULT'
                        ]
                    ],
                    'local_backend' => 'Cm_Cache_Backend_File',
                    'local_backend_options' => [
                        'cache_dir' => '/dev/shm/'
                    ],
                    'use_stale_cache' => false
                ],
                'frontend_options' => [
                    'write_control' => false
                ],
                'id_prefix' => 'a31_'
            ],
            'page_cache' => [
                'id_prefix' => 'a313_'
            ]
        ],
        'type' => [
            'default' => [
                'frontend' => 'default'
            ]
        ],
        'graphql' => [
            'id_salt' => '00000000000000000000000000000000000'
        ],
        'allow_parallel_generation' => false
    ],
    'queue' => [
        'consumers_wait_for_messages' => 0,
        'amqp' => [
            'host' => '127.0.0.1',
            'port' => '5672',
            'user' => 'guest',
            'password' => 'guest',
            'virtualhost' => '/',
            'ssl' => ''
        ]
    ],
    'cron_consumers_runner' => [
        'cron_run' => true,
        'max_messages' => 0,
        'single_thread' => true,
        'consumers-wait-for-messages' => 0,
        'consumers' => [
            'product_action_attribute.update',
            'product_action_attribute.website.update',
            'codegeneratorProcessor',
            'exportProcessor',
            'quoteItemCleaner',
            'async.operations.all',
            'inventoryQtyCounter',
            'media.content.synchronization',
            'media.gallery.renditions.update',
            'media.gallery.synchronization',
            'sales.rule.update.coupon.usage',
            'media.storage.catalog.image.resize',
            'matchCustomerSegmentProcessor',
            'sales.rule.quote.trigger.recollect',
            'staging.synchronize_entity_period',
            'product_alert',
            'placeOrderProcessor',
            'inventory.source.items.cleanup',
            'inventory.mass.update',
            'inventory.reservations.cleanup',
            'inventory.reservations.update',
            'inventory.reservations.updateSalabilityStatus',
            'inventory.indexer.sourceItem',
            'inventory.indexer.stock'
        ]
    ],
    'indexer' => [
        'use_application_lock' => true,
        'batch_size' => [
            'catalogsearch_fulltext' => [
                'partial_reindex' => 100,
                'mysql_get' => 500,
                'elastic_save' => 500
            ],
            'catalog_product_price' => [
                'simple' => 1000,
                'default' => 500,
                'configurable' => 1000
            ]
        ]
    ],
    'remote_storage' => [
        'driver' => 'file'
    ],
    'http_cache_hosts' => [
        [
            'host' => 'localhost',
            'port' => '80'
        ]
    ],
    'lock' => [
        'provider' => 'db'
    ],
    'directories' => [
        'document_root_is_pub' => true
    ],
    'checkout' => [
        'async' => 0,
        'deferred_total_calculating' => 0
    ]
];

What I did but didnt’ work:

  1. Redis session_locking onoff and max_concurrency
  2. Removed redis from env.php session and made php save session to files
  3. Disable tag manager
  4. Tried different Ajax carts

Issue stops only with native magento cart without Ajax

I can’t figure out how to debug it and I am very worried because I believe that we have clients who add products to cart the when they go to cart or checkout, it is empty.
That’s very bad for our store.

Any ideas please? Is there a way to debug this random issue?