I have setup the Magento 2.4 on Windows 10. I have run these commands to install the sampledata:

php bin/magento sampledata:deploy   - Working 
php bin/magento setup:upgrade   - Error

Error: Unable to apply data patch Magento\CatalogSampleData\Setup\Patch\Data\InstallCatalogSampleData for module Magento_CatalogSampleData. Original exception message: Rolled back transaction has not been completed correctly.

For clarification see attached screenshot: enter image description here

Note- I am getting this error only in Magento2.4 version


7 Answers 7


If you change the DB connection to a new DB then try to delete composer.lock and run composer install, then bin/magento setup:upgrade. That works for me.


Please check this link I think it has your answer.




Here is the Github Issue describing the problem. It was fixed for the next develop version of 2.4 in October 2020.

Here is the specific PR that was accepted into the 2.4 release branch.

I haven't yet found a workaround other than "it's fixed in the next version".


I faced the same issue in the CustomerSampleData module. I temporarily resolved this in v2.3.6 by commenting out the following line:


at: vendor/magento/module-customer-sample-data/Setup/Installer.php

Final Code:

public function install()

Seems to be something funky in the CSV. Re-run setup-upgrade and you should be good.


I did had such a problem and recovered by run command php bin/magento sampledata:remove after upgrade run normally

  • 1
    But this command removes sample data installed. This is not fix for the issue. We need smaple data in magento 2.4 Feb 13, 2023 at 7:18

Looks like a bug for Magento 2.4 versions. Found this solution:

bin/magento module:uninstall --remove-data --clear-static-content Magento_CatalogRuleSampleData Magento_SalesRuleSampleData

But not a recommended solution. As it does not contain complete sample data information.


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 vendor/magento/module catalogue rule sample data/setup/installer.php and vendor/magento/module sales rule sample data/setup/installer.php. 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.