0

How to fix the below Error when magento upgrade 2.2.1 to 2.4.3.

When I have run setup upgrade command then showing error.

Unable to apply data patch Magento\Tax\Setup\Patch\Data\UpdateTaxRegionId for module Magento_Tax. Original exception message: Code already exists.

2 Answers 2

1

Whenever a patch is run, Magento adds it into the patch_list table, so, the next time when you run setup:upgrade, it checks if that patch is present in that table, then it skips the patch. So, what you can do, is just manually add \Magento\Tax\Setup\Patch\Data\UpdateTaxRegionId into the table.

0

I guess this issue occurred during php bin/magento setup:upgrade

look like you already applied patch earlier and upgrade want to apply it again so, simply you can delete this file

/vendor/magento/module-tax/Setup/Patch/Data/UpdateTaxRegionId.php

or try to upgrade with latest version 2.4.3-p2 this may also fix problem

Update


If you were upgrading to Adobe Commerce (all deployment methods)/Magneto Open Source version 2.3.5, upgrade to version 2.3.5-p1. Adobe Commerce (all deployment methods)/Magento Open Source version 2.3.5-p1 replaces 2.3.5.

If you were upgrading to Adobe Commerce (all deployment methods)/Magento Open Source version 2.3.4-p1, upgrade to version 2.3.4-p2. Adobe Commerce (all deployment methods)/Magneto Open Source version 2.3.4-p2 replaces version 2.3.4-p1.

9
  • Yes, I have already deleted this file and work perfect but I need proper solution. Feb 22, 2022 at 9:53
  • then I guess you need to upgrade in latest version 2.4.3-p2 instead of 2.4.3 Feb 22, 2022 at 10:01
  • Yes, But First I will done all issues in 2.4.3 then upgrade in 2.4.3-p2. Thanks @Gohil Rajesh Feb 22, 2022 at 10:17
  • welcome @BhaveshGodhani Feb 22, 2022 at 10:23
  • Please do not advise people to delete or modify core code, this is never recommended
    – Dan Staver
    Feb 24, 2022 at 3:01

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.