# Upgrade Tool 4.x under Windows not working

**URL:** <https://discourse.cakephp.org/t/upgrade-tool-4-x-under-windows-not-working/11247>\
**Category:** Need Help\
**Created:** [June 1, 2023, 4:28pm UTC](https://discourse.cakephp.org/t/upgrade-tool-4-x-under-windows-not-working/11247 "2023-06-01T16:28:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Manuel1948](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/manuel1948/32/2751_2.png) [@Manuel1948](https://discourse.cakephp.org/u/Manuel1948)\
**Post date:** [June 1, 2023, 4:28pm UTC](https://discourse.cakephp.org/t/upgrade-tool-4-x-under-windows-not-working/11247/1 "2023-06-01T16:28:08Z")

</div>

Dear cake eaters,

I have a problem migrating/upgrading from cakePHP 3.10.5 to 4.0, because the file\_rename action causes an error, which I don’t understand. The operation must be run in a work tree… What is a work tree or how to run the operation there, what is my error with the command?

administrator@a-dc01 MINGW64 /c/xampp/htdocs/cakephp/upgrade (4.x)  
$ **bin/cake upgrade file\_rename locales …/ --verbose**  
Renaming C:\xampp\htdocs\cakephp\src/Locale  
Move C:\xampp\htdocs\cakephp\src/Locale to C:\xampp\htdocs\cakephp\resources/locales  
**fatal: this operation must be run in a work tree**  
PHP Fatal error: Uncaught Error: Class “Cake\Upgrade\Command\FatalErrorException” not found in C:\xampp\htdocs\cakephp\upgrade\src\Command\FileRenameCommand.php:330  
Stack trace:  
#0 C:\xampp\htdocs\cakephp\upgrade\src\Command\FileRenameCommand.php(161): Cake\Upgrade\Command\FileRenameCommand-\>rename(‘C:\xampp\htdocs…’, ‘C:\xampp\htdocs…’)  
#1 C:\xampp\htdocs\cakephp\upgrade\src\Command\FileRenameCommand.php(107): Cake\Upgrade\Command\FileRenameCommand-\>processLocales()  
#2 C:\xampp\htdocs\cakephp\upgrade\vendor\cakephp\cakephp\src\Console\BaseCommand.php(189): Cake\Upgrade\Command\FileRenameCommand-\>execute(Object(Cake\Console\Arguments), Object(Cake\Console\ConsoleIo))  
#3 C:\xampp\htdocs\cakephp\upgrade\vendor\cakephp\cakephp\src\Console\CommandRunner.php(334): Cake\Console\BaseCommand-\>run(Array, Object(Cake\Console\ConsoleIo))  
#4 C:\xampp\htdocs\cakephp\upgrade\vendor\cakephp\cakephp\src\Console\CommandRunner.php(172): Cake\Console\CommandRunner-\>runCommand(Object(Cake\Upgrade\Command\FileRenameCommand), Array, Object(Cake\Console\ConsoleIo))  
#5 C:\xampp\htdocs\cakephp\upgrade\bin\cake.php(12): Cake\Console\CommandRunner-\>run(Array)  
#6 {main}  
thrown in C:\xampp\htdocs\cakephp\upgrade\src\Command\FileRenameCommand.php on line 330

Fatal error: Uncaught Error: Class “Cake\Upgrade\Command\FatalErrorException” not found in C:\xampp\htdocs\cakephp\upgrade\src\Command\FileRenameCommand.php:330  
Stack trace:  
#0 C:\xampp\htdocs\cakephp\upgrade\src\Command\FileRenameCommand.php(161): Cake\Upgrade\Command\FileRenameCommand-\>rename(‘C:\xampp\htdocs…’, ‘C:\xampp\htdocs…’)  
#1 C:\xampp\htdocs\cakephp\upgrade\src\Command\FileRenameCommand.php(107): Cake\Upgrade\Command\FileRenameCommand-\>processLocales()  
#2 C:\xampp\htdocs\cakephp\upgrade\vendor\cakephp\cakephp\src\Console\BaseCommand.php(189): Cake\Upgrade\Command\FileRenameCommand-\>execute(Object(Cake\Console\Arguments), Object(Cake\Console\ConsoleIo))  
#3 C:\xampp\htdocs\cakephp\upgrade\vendor\cakephp\cakephp\src\Console\CommandRunner.php(334): Cake\Console\BaseCommand-\>run(Array, Object(Cake\Console\ConsoleIo))  
#4 C:\xampp\htdocs\cakephp\upgrade\vendor\cakephp\cakephp\src\Console\CommandRunner.php(172): Cake\Console\CommandRunner-\>runCommand(Object(Cake\Upgrade\Command\FileRenameCommand), Array, Object(Cake\Console\ConsoleIo))  
#5 C:\xampp\htdocs\cakephp\upgrade\bin\cake.php(12): Cake\Console\CommandRunner-\>run(Array)  
#6 {main}  
thrown in C:\xampp\htdocs\cakephp\upgrade\src\Command\FileRenameCommand.php on line 330

---

<div class="post-metadata">

**Author:** ![Manuel1948](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/manuel1948/32/2751_2.png) [@Manuel1948](https://discourse.cakephp.org/u/Manuel1948)\
**Post date:** [June 1, 2023, 5:03pm UTC](https://discourse.cakephp.org/t/upgrade-tool-4-x-under-windows-not-working/11247/2 "2023-06-01T17:03:55Z")

</div>

Okay, I found out that this has something to do with the “git mv” command in the FileRenameCommand.php. SInce I am no expert with git I don’t know what a working tree is and also don’t understand the things I quickly googled, so I uncommented the if($this-\>git) sections in the php and then run the command again.

I know it is not very good, because git showing much new file changes, but I want to migrated the thing and not struggle with git…

---

<div class="post-metadata">

**Author:** ![Kaiser85](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/kaiser85/32/2714_2.png) [@Kaiser85](https://discourse.cakephp.org/u/Kaiser85)\
**Post date:** [June 1, 2023, 6:35pm UTC](https://discourse.cakephp.org/t/upgrade-tool-4-x-under-windows-not-working/11247/3 "2023-06-01T18:35:08Z")

</div>

[4.0 Upgrade Guide - 4.x](https://book.cakephp.org/4/en/appendices/4-0-upgrade-guide.html#use-the-upgrade-tool) Have you checked the warning in this part of the documentation?

Is your project folder a git repository? Apparently that’s the problem.

---

<div class="post-metadata">

**Author:** ![Manuel1948](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/manuel1948/32/2751_2.png) [@Manuel1948](https://discourse.cakephp.org/u/Manuel1948)\
**Post date:** [June 1, 2023, 7:45pm UTC](https://discourse.cakephp.org/t/upgrade-tool-4-x-under-windows-not-working/11247/4 "2023-06-01T19:45:33Z")

</div>

yes i have checked and took care of it
