skip to Main Content

Getting the below error while trying to install sample data and upgrading the setup in Magento 2.4.2-p1
Error: Unable to apply data patch MagentoCatalogRuleSampleDataSetupPatchDataInstallCatalogRuleSampleData for module Magento_CatalogRuleSampleData. Original exception message: Rolled back transaction has not been completed correctly.

Please help.

4

Answers


  1. Syntax error(s) are existed in the following sample csv files.

    /vendor/magento/module-catalog-rule-sample-data/fixtures/catalog_rules.csv
    /vendor/magento/module-sales-rule-sample-data/fixtures/sales_rules.csv
    

    2 solutions for the above issue:

    1. Fix and validate the above CSVs manually or online tool like https://csvlint.io/

    2. Comment line of code, calling above CSVs

      MagentoCatalogRuleSampleDataSetupInstaller.php
      MagentoSalesRuleSampleDataSetupInstaller.php
      
      like:
          /**
           * {@inheritdoc}
           */
          public function install()
          {
              //$this->rule->install(['Magento_CatalogRuleSampleData::fixtures/catalog_rules.csv']);
          }
      
    Login or Signup to reply.
  2. I had such a problem and recovered by running the command:

    php bin/magento sampledata:remove 
    

    After upgrading, just run normally.

    Login or Signup to reply.
  3. I also received the same error and invested four days rectifying it.

    I also tried the above solution, i.e., commenting the line under install function from catalogue rule sample data and sales rule sample data. It too worked, but only temporarily. Because after following the above procedure, you cannot see the products from your Magento homepage, just banners only visible to you.

    The real problem is that there is no sufficient space to deploy the sample data. Clear more than 4GB of space on your system and try it. It will work.

    Login or Signup to reply.
  4. You need to set correct permissions for var/ pub/ & generated/ directories

    after above, your error will be vanished on setup:upgrade

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search