Search

Mar 29, 2023

The update with the "1640505600" ID doesn't exist. Verify the ID and try again

ISSUE:

Got the error when trying to run the command: bin/magento i:rei catalogrule_product

report.CRITICAL: The update with the "1640505600" ID doesn't exist. Verify the ID and try again. {"exception":"[object] (Magento\\Framework\\Exception\\NoSuchEntityException(code: 0): The update with the \"1640505600\" ID doesn't exist. Verify the ID and try again. at /vendor/magento/module-staging/Model/UpdateRepository.php:103)"} 


REASON:

Unfortunately, this is very old issue and M2 still collect all needed information about possible triggers that cause it. M2 did lot's of fixes already but still sometimes experience it. 

Let me share and explain what they can state now.

When might this happen?

The issue may occur after operations with scheduled updates for store content assets (Content Staging). For example, you may have deleted a Product with a scheduled update, or removed the end date for such an update.

A store content asset may be:

    + Product

    + Category

    + Catalog Price Rule

    + Cart Price Rule

    + CMS Page

    + CMS Block

    + Widget

Some scenarios are discussed in the Possible Trigger section below.

Cause

The `flag` table in the database (DB) contains invalid links to the `staging_update` table.

See an example below:

- select * fromstaging_update;

Empty set(0.00 sec)

- select* fromflag;

+---------+---------------------+-------+-------------------------------------------------+---------------------+

| flag_id | flag_code           | state | flag_data                                       | last_update         |

+---------+---------------------+-------+-------------------------------------------------+---------------------+

|       1 | staging             |     0 | a:1:{s:15:"current_version";s:10:"1490005140";} | 2017-03-20 15:49:07 |

+---------+---------------------+-------+-------------------------------------------------+---------------------+

where:

    `flag_code` points to the `staging_update` table

    `flag_data` points to a record with a scheduled update that is no longer available in the `staging_update` table

Possible trigger: operations involving Content Staging

The problem is related to Content Staging (updates for store content assets scheduled using the Magento_Staging module). Below are two particular scenarios; please note there might be more situations that trigger the issue.

Scenario 1: 
Deleting a store content asset which:
    + has an update scheduled with Content Staging
    + the update has an end date (meaning the expiry date after which the updated asset reverts to its previous version)
    + the end date of the update is in the past

At the same time, the issue might not occur if a deleted asset has no end date for the scheduled update.

Scenario 2: 
Removing the end date/time of a scheduled update.

 

SOLUTION 1: 

1. Remove record in flag table:

select * from flag WHERE flag_code = "staging";

delete from flag WHERE flag_code = "staging";

2. Run reindex for catalogrule_product again.


SOLUTION 2: 

Follow the patch

diff --git a/vendor/magento/module-checkout-staging/Model/PreviewQuotaManager.php 
b/vendor/magento/module-checkout-staging/Model/PreviewQuotaManager.php
index f6d232f999d..e0034a9fbf2 100644
--- a/vendor/magento/module-checkout-staging/Model/PreviewQuotaManager.php
+++ b/vendor/magento/module-checkout-staging/Model/PreviewQuotaManager.php
@@ -90,14 +90,14 @@ class PreviewQuotaManager
                 )
             );
 
-            $this->searchCriteriaBuilder->addFilter('entity_id', $ids, 'in');
+            $this->searchCriteriaBuilder->addFilter('main_table.entity_id', $ids, 'in');
             $this->searchCriteriaBuilder->addFilter(
-                CartInterface::KEY_STORE_ID,
+                'main_table.' . CartInterface::KEY_STORE_ID,
                 $storeId,
                 'eq'
             );
             $this->searchCriteriaBuilder->addFilter(
-                CartInterface::KEY_UPDATED_AT,
+                'main_table.' . CartInterface::KEY_UPDATED_AT,
                 $now->format('Y-m-d H:i:s'),
                 'to'
             );

No comments:

Post a Comment