# Build.bat fails exited with code 6

**URL:** <https://forums.unrealengine.com/t/build-bat-fails-exited-with-code-6/237526>\
**Category:** C++\
**Tags:** unreal-engine, Engine-Source-Code, GitHub\
**Created:** [June 26, 2021, 5:28am UTC](https://forums.unrealengine.com/t/build-bat-fails-exited-with-code-6/237526 "2021-06-26T05:28:51Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_f00cc662](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_f00cc662](https://forums.unrealengine.com/u/anonymous_user_f00cc662)\
**Post date:** [June 26, 2021, 5:28am UTC](https://forums.unrealengine.com/t/build-bat-fails-exited-with-code-6/237526/1 "2021-06-26T05:28:51Z")

</div>

For the last several months I’ve been building UE source version 4.26 with no problem. Today our company distributed licenses to switch from VS Community 2019 to VS Pro 2019 and so I updated to VS Pro 2019. Doing this caused all my modules to have to be rebuilt. I’ve got the UE4.sln loaded into VS Pro 2019, and when I try to build, everything builds until I get to the end when I get this:

1\>Building 5 actions with 8 processes…  
1\> [1/5] dte80a.tlh  
1\>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Microsoft\VC\v160\Microsoft.MakeFile.Targets(45,5): error MSB3073: The command “…..\Build\BatchFiles\Build.bat -Target=“UE4Editor Win64 Development” -Target=“ShaderCompileWorker Win64 Development -Quiet” -WaitMutex -FromMsBuild” exited with code 6.  
1\>Done building project “UE4.vcxproj” – FAILED.

I’ve run Setup.bat and run through all the steps that you do for initial setup that I can think of. Does anyone have any idea what might be the issue or how to debug?

After some googling I’ve found this thread:  
[https://www.reddit.com/r/unrealengine/comments/igu48i/cannot\_build\_ue4\_development\_editor\_vs\_2019\_latest/](https://www.reddit.com/r/unrealengine/comments/igu48i/cannot_build_ue4_development_editor_vs_2019_latest/)  
Which points out that the command shown in the error has an extra quote mark immediately following the -Quiet option. Any idea how to get rid of that quote?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_f00cc662](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_f00cc662](https://forums.unrealengine.com/u/anonymous_user_f00cc662)\
**Post date:** [June 26, 2021, 7:51pm UTC](https://forums.unrealengine.com/t/build-bat-fails-exited-with-code-6/237526/2 "2021-06-26T19:51:33Z")

</div>

I found to edit out the extra quote, in Visual Studio open the UE4 project’s property page, and under Configuration Properties select NMake. This will show you a Build Command LIne, Rebuild All Command Line and a Clean Command Line. These can be edited to remove the extra quote.

But that didn’t fix anything for me. (Maybe it will for someone else though)

To fix my error I found this page:

> <https://stackoverflow.com/questions/63527007/cannot-compile-unreal-engine-4-25-with-visual-studio-2019-7-2>

And following the instructions there, I deleted my “Engine\Intermediate\Build\Win64\UE4Editor” folder and did a rebuild. After the delete, my build went fine.

---

<div class="post-metadata">

**Author:** ![Amoryleaf](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Amoryleaf](https://forums.unrealengine.com/u/Amoryleaf)\
**Post date:** [August 16, 2022, 5:48pm UTC](https://forums.unrealengine.com/t/build-bat-fails-exited-with-code-6/237526/3 "2022-08-16T17:48:52Z")

</div>

I got the same error message as @anonymous_user_f00cc662 _except_ I also had this message:

```
Distributing 47 actions to XGE (TaskId:15)
Maximum number of concurrent builds reached. (TaskId:15)

```

This might look like a red herring (it did to me at first), but if you get this error, open up Task Manager and check if there are any orphaned ShaderCompileWorker threads. I had 2 of them. After ending those tasks my project starting building again 😌

P.S. The quote after -Quiet is supposed to be there. In Visual Studio’s error message it just _looks_ wrong

---

<div class="post-metadata">

**Author:** ![Faptdivers](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Faptdivers](https://forums.unrealengine.com/u/Faptdivers)\
**Post date:** [January 23, 2023, 10:05pm UTC](https://forums.unrealengine.com/t/build-bat-fails-exited-with-code-6/237526/4 "2023-01-23T22:05:55Z")

</div>

You might have the same plugin installed in the Editor and in the Game “Plugins” folder.

---

<div class="post-metadata">

**Author:** ![HungryHenry](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/hungryhenry/32/722352_2.png) [@HungryHenry](https://forums.unrealengine.com/u/HungryHenry)\
**Post date:** [February 22, 2023, 8:07am UTC](https://forums.unrealengine.com/t/build-bat-fails-exited-with-code-6/237526/5 "2023-02-22T08:07:33Z")

</div>

I’ve encountered the most hilarious situation. My project and engine are installed in a folder called “Epic Games”, and the space between them broke the command line. Make sure your file paths are without any space.

---

<div class="post-metadata">

**Author:** ![eblade](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@eblade](https://forums.unrealengine.com/u/eblade)\
**Post date:** [February 25, 2023, 2:50am UTC](https://forums.unrealengine.com/t/build-bat-fails-exited-with-code-6/237526/6 "2023-02-25T02:50:28Z")

</div>

The quotes in the command line need to be there to provide arguments to the other binaries.

Most likely because some of the support libs were built with the previous version of the builds tools. Blow away Intermediate, and rebuild, to be safe.

---

<div class="post-metadata">

**Author:** ![BOBtheROSS](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@BOBtheROSS](https://forums.unrealengine.com/u/BOBtheROSS)\
**Post date:** [May 21, 2023, 3:57pm UTC](https://forums.unrealengine.com/t/build-bat-fails-exited-with-code-6/237526/7 "2023-05-21T15:57:30Z")

</div>

> [@eblade](#):
>
> Blow away Intermediate

yep, that blew away my visual studio project structure…  
So, don’t do that.

---

<div class="post-metadata">

**Author:** ![Ysgrathe](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/ysgrathe/32/740512_2.png) [@Ysgrathe](https://forums.unrealengine.com/u/Ysgrathe)\
**Post date:** [August 29, 2023, 5:37pm UTC](https://forums.unrealengine.com/t/build-bat-fails-exited-with-code-6/237526/8 "2023-08-29T17:37:30Z")

</div>

In case anyone else stumbles on this thread:  
Actually, YES, do DO THAT.  
For many problems, this is part of the fix. Delete the Intermediate folder (and the binaries folder too)  
Then, right click the .uproject file, and select the ‘Generate Visual Studio Project Files’  
to build a new .sln file based on the source files it finds.  
The Intermediate folder is NOT part of that process, and it CAN safely be deleted.

---

<div class="post-metadata">

**Author:** ![MrXyron](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MrXyron](https://forums.unrealengine.com/u/MrXyron)\
**Post date:** [September 9, 2023, 9:32pm UTC](https://forums.unrealengine.com/t/build-bat-fails-exited-with-code-6/237526/9 "2023-09-09T21:32:14Z")

</div>

So I went directly to the source of the problem

And ran this cmd

```auto
C:\Program Files\Epic Games\UE_5.3\Engine\Build\BatchFiles>build MyProjectEditor Win64 Development -Project="C:\Users\18135\Desktop\UEpro\MyProject\MyProject.uproject" -WaitMutex -FromMsBuild"

```

It then gave me this error…

`Unable to build while Live Coding is active. Exit the editor and game, or press Ctrl+Alt+F11 if iterating on code in the editor or game`

I closed unreal engine ran it again and it worked…so not sure what I have to do to get live coding working but that’s what I found

---

<div class="post-metadata">

**Author:** ![Doctor\_Kannon](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/doctor_kannon/32/1130101_2.png) [@Doctor\_Kannon](https://forums.unrealengine.com/u/Doctor_Kannon)\
**Post date:** [September 25, 2023, 1:43am UTC](https://forums.unrealengine.com/t/build-bat-fails-exited-with-code-6/237526/10 "2023-09-25T01:43:12Z")

</div>

Don’t delete it until you have tested it. Rename the folder to testDelete\_intermediate (or something to that effect). Then test the build. If it still fails, you can restore the intermediate file if necessary.

---

<div class="post-metadata">

**Author:** ![Ysgrathe](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/ysgrathe/32/740512_2.png) [@Ysgrathe](https://forums.unrealengine.com/u/Ysgrathe)\
**Post date:** [September 25, 2023, 5:56am UTC](https://forums.unrealengine.com/t/build-bat-fails-exited-with-code-6/237526/11 "2023-09-25T05:56:49Z")

</div>

I was like that too when I started with unreal, I (of course) backed up folders before deleting.  
But now I know better; intermediate is not part of your project, it is an (intermediate, duh) product of it. IT IS SAFE TO DELETE, and more than that, it is ABSOLUTELY NOT something you want to include in source control (add it to the .gitignore if you use git/github), similarly, the VS solution (.sln) should also NOT be included in source control.  
This may seem a little counter intuitive to anyone used to making other types of projects with VS, but it is how Unreal works - it makes the solution for you, and the intermediate folder is a part of what it does. Sometimes there can be problems because things get out of sync between what has been made in the intermediate folder and what is in your source code… So you delete that intermediate folder, and recreate a new .SLN

Feel comfortable that it IS perfectly fine to delete it, because a properly source controlled project should NEVER have either the .SLN or the intermediate folder in it - they get created, when you first download the project and generate the SLN, and then when you open that solution and start using it (and build, etc)

I even have a .bat file in the project folder which i run to automatically delete things and recreate the solution, because it is something you might need to do occasionally, especially if you are working on a collaborative project using Git where the source code pull can get the solution out of sync with the actual sourcecode you now have.

---

<div class="post-metadata">

**Author:** ![Doctor\_Kannon](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/doctor_kannon/32/1130101_2.png) [@Doctor\_Kannon](https://forums.unrealengine.com/u/Doctor_Kannon)\
**Post date:** [September 25, 2023, 6:37am UTC](https://forums.unrealengine.com/t/build-bat-fails-exited-with-code-6/237526/12 "2023-09-25T06:37:17Z")

</div>

This worked. Thank you.

---

<div class="post-metadata">

**Author:** ![MittzyZea](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mittzyzea/32/914245_2.png) [@MittzyZea](https://forums.unrealengine.com/u/MittzyZea)\
**Post date:** [June 24, 2024, 5:22pm UTC](https://forums.unrealengine.com/t/build-bat-fails-exited-with-code-6/237526/13 "2024-06-24T17:22:34Z")

</div>

For me, the solution was to go to MyProjectEditor.Target.cs and change the line:

```auto
DefaultBuildSettings = BuildSettingsVersion.V2

```

to

```auto
DefaultBuildSettings = BuildSettingsVersion.V4

```

(The only difference is the changing of “V2” to “V4”.) My project compiled after this change.

**EDIT:** As of Unreal 5.4, you now have to set DefaultBuiltSettings to `BuiltSettingsVersion.V5` or `BuildSettingsVersion.Latest`

---

<div class="post-metadata">

**Author:** ![TheTrueBenjamin](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TheTrueBenjamin](https://forums.unrealengine.com/u/TheTrueBenjamin)\
**Post date:** [October 30, 2024, 2:35am UTC](https://forums.unrealengine.com/t/build-bat-fails-exited-with-code-6/237526/14 "2024-10-30T02:35:35Z")

</div>

Thank you. This fixed it for me.

---

<div class="post-metadata">

**Author:** ![B0realian](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@B0realian](https://forums.unrealengine.com/u/B0realian)\
**Post date:** [November 25, 2024, 2:12pm UTC](https://forums.unrealengine.com/t/build-bat-fails-exited-with-code-6/237526/15 "2024-11-25T14:12:46Z")

</div>

This lead me to the solution! Thank you!

Turned out some sloppy coding wasn’t shown by VS but troubled the Build. I had some functions with local variables that hid member variables. I do that sometimes for clarity when I return the value of the local variable into the member variable anyway and it has worked before but this time I guess UE finally objected to that practice. Maybe it was just that the functions hadn’t been properly fleshed out yet (I was still laying out the structure of the class).

Anyway, I changed some variable names and suddenly everything works again!

---

<div class="post-metadata">

**Author:** ![siqso\_99](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@siqso\_99](https://forums.unrealengine.com/u/siqso_99)\
**Post date:** [January 5, 2025, 4:17pm UTC](https://forums.unrealengine.com/t/build-bat-fails-exited-with-code-6/237526/16 "2025-01-05T16:17:39Z")

</div>

Worked like a charm. much appreciated

---

<div class="post-metadata">

**Author:** ![pefritzii](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@pefritzii](https://forums.unrealengine.com/u/pefritzii)\
**Post date:** [February 1, 2025, 3:05am UTC](https://forums.unrealengine.com/t/build-bat-fails-exited-with-code-6/237526/17 "2025-02-01T03:05:30Z")

</div>

This worked for me. Thank you!!  
I am using 5.5 and just changed both the V2 from an older project to Latest in "YourProjectName"Editor.Target.cs and “YouProjectName”.Target,cs. I also had to right click on the uproject and Generate VS Project since I am also using Visual Studio. After that the project built with errors from out of date includes. Once updated the project built and I was able to open the UE project.

---

<div class="post-metadata">

**Author:** ![mehmetturk123](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mehmetturk123/32/1074066_2.png) [@mehmetturk123](https://forums.unrealengine.com/u/mehmetturk123)\
**Post date:** [June 11, 2025, 2:47pm UTC](https://forums.unrealengine.com/t/build-bat-fails-exited-with-code-6/237526/18 "2025-06-11T14:47:13Z")

</div>

You are savior, thanks a lot! 🙂

---

<div class="post-metadata">

**Author:** ![\_1117](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/_1117/32/710746_2.png) [@\_1117](https://forums.unrealengine.com/u/_1117)\
**Post date:** [July 6, 2025, 8:11pm UTC](https://forums.unrealengine.com/t/build-bat-fails-exited-with-code-6/237526/19 "2025-07-06T20:11:51Z")

</div>

That worked for me, Delete Intermediate folder and **Rebuild** (not **Build** ) the project from the IDE (visual studio).

---

<div class="post-metadata">

**Author:** ![RIFFF](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rifff/32/700067_2.png) [@RIFFF](https://forums.unrealengine.com/u/RIFFF)\
**Post date:** [July 20, 2025, 3:54pm UTC](https://forums.unrealengine.com/t/build-bat-fails-exited-with-code-6/237526/20 "2025-07-20T15:54:26Z")

</div>

Worked. thanks a lot

[Next page](https://forums.unrealengine.com/t/build-bat-fails-exited-with-code-6/237526.md?page=2)
