# Unreal Build Tool Error: ubt\> ERROR: Unhandled exception: System.ArgumentNullException: Value cannot be null

**URL:** <https://forums.unrealengine.com/t/unreal-build-tool-error-ubt-error-unhandled-exception-system-argumentnullexception-value-cannot-be-null/469851>\
**Category:** C++\
**Tags:** engine-compile, unreal-engine, CPP, question, build-editor, compile-editor\
**Created:** [August 19, 2020, 6:04am UTC](https://forums.unrealengine.com/t/unreal-build-tool-error-ubt-error-unhandled-exception-system-argumentnullexception-value-cannot-be-null/469851 "2020-08-19T06:04:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![DevinSherry](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/devinsherry/32/1101099_2.png) [@DevinSherry](https://forums.unrealengine.com/u/DevinSherry)\
**Post date:** [August 19, 2020, 6:04am UTC](https://forums.unrealengine.com/t/unreal-build-tool-error-ubt-error-unhandled-exception-system-argumentnullexception-value-cannot-be-null/469851/1 "2020-08-19T06:04:04Z")

</div>

When I attempt to compile via the Unreal Game Sync, I receive the following error:

```
Compiling HeroEditor...
ubt> Running D:\Hero4.25\Engine\Binaries\DotNET\UnrealBuildTool.exe HeroEditor Win64 Debug "D:\Hero4.25\Hero\Hero.uproject" -NoHotReloadFromIDE -progress
ubt> Using 'git status' to determine working set for adaptive non-unity build (D:\Hero4.25).
ubt> Creating makefile for HeroEditor (Build.version is newer)
ubt> ERROR: Unhandled exception: System.ArgumentNullException: Value cannot be null.
ubt> Parameter name: path
ubt> at System.IO.Path.GetFullPathInternal(String path)
ubt> at Tools.DotNETCommon.FileReference..ctor(String InPath)
ubt> at UnrealBuildTool.WindowsBuildHostPlatform.get_Shell()
ubt> at UnrealBuildTool.VCToolChain.GenerateTypeLibraryHeader(CppCompileEnvironment CompileEnvironment, TypeLibrary TypeLibrary, FileReference OutputFile, IActionGraphBuilder Graph)
ubt> at UnrealBuildTool.UEBuildModule.Compile(ReadOnlyTargetRules Target, UEToolChain ToolChain, CppCompileEnvironment CompileEnvironment, FileReference SingleFileToCompile, ISourceFileWorkingSet WorkingSet, IActionGraphBuilder Graph)
ubt> at UnrealBuildTool.UEBuildBinary.SetupBinaryLinkEnvironment(ReadOnlyTargetRules Target, UEToolChain ToolChain, LinkEnvironment LinkEnvironment, CppCompileEnvironment CompileEnvironment, FileReference SingleFileToCompile, ISourceFileWorkingSet WorkingSet, DirectoryReference ExeDir, IActionGraphBuilder Graph)
ubt> at UnrealBuildTool.UEBuildBinary.Build(ReadOnlyTargetRules Target, UEToolChain ToolChain, CppCompileEnvironment CompileEnvironment, LinkEnvironment LinkEnvironment, FileReference SingleFileToCompile, ISourceFileWorkingSet WorkingSet, DirectoryReference ExeDir, IActionGraphBuilder Graph)
ubt> at UnrealBuildTool.UEBuildTarget.Build(BuildConfiguration BuildConfiguration, ISourceFileWorkingSet WorkingSet, Boolean bIsAssemblingBuild, FileReference SingleFileToCompile)
ubt> at UnrealBuildTool.BuildMode.CreateMakefile(BuildConfiguration BuildConfiguration, TargetDescriptor TargetDescriptor, ISourceFileWorkingSet WorkingSet)
ubt> at UnrealBuildTool.BuildMode.Build(List`1 TargetDescriptors, BuildConfiguration BuildConfiguration, ISourceFileWorkingSet WorkingSet, BuildOptions Options, FileReference WriteOutdatedActionsFile)
ubt> at UnrealBuildTool.BuildMode.Execute(CommandLineArguments Arguments)
ubt> at UnrealBuildTool.UnrealBuildTool.Main(String[] ArgumentsArray)
p4> p4.exe -p1666 -uDevinSherry -cHero_Depot -s -zprog=UGS -zversion=1.201.7526.27462 -ztag opened "//Hero_Depot/..."
Failed to compile HeroEditor.

```

I am still able to, via Visual Studio, compile both the engine and the project, and launch the editor through Visual Studio. However, whenever I try to compile via Unreal Game Sync, or compile/hot-reload from the editor, I get the aforementioned error.

Here are some key pieces of information:

1. This is Unreal Engine 4.25.3 compiled from the Unreal Engine Github; not an engine from the Unreal Launcher.

2. Last week, I was able to compile through Unreal Game Sync, and the only thing I can think of that has changed since then is the installation of UnrealVS.

3. When I attempt to compile the engine as Development Editor in Visual Studio I receive the following:

---

<div class="post-metadata">

**Author:** ![Yuri9447](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Yuri9447](https://forums.unrealengine.com/u/Yuri9447)\
**Post date:** [February 16, 2023, 8:34am UTC](https://forums.unrealengine.com/t/unreal-build-tool-error-ubt-error-unhandled-exception-system-argumentnullexception-value-cannot-be-null/469851/2 "2023-02-16T08:34:37Z")

</div>

I also had this problem when I am debugging UBT. Here is how I solved it. I noticed that BuildHostPlatform.Current.Shell is null.

 ![Snipaste_2023-02-16_16-27-50](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/e/b/1ebdb27c40b6d3acaee5c6646dfbbe255022cabd.png)  
And on Windows platform, it says to get the shell by environment variable “ComSpec”.  
 ![Snipaste_2023-02-16_16-28-13](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/e/e/4ee49c4691361d756dc23bc42784170ae1727ea7.png)  
So I added this environment variable and problem solved. Hope this can help you!

---

<div class="post-metadata">

**Author:** ![Jemish7120](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Jemish7120](https://forums.unrealengine.com/u/Jemish7120)\
**Post date:** [May 22, 2023, 7:32am UTC](https://forums.unrealengine.com/t/unreal-build-tool-error-ubt-error-unhandled-exception-system-argumentnullexception-value-cannot-be-null/469851/4 "2023-05-22T07:32:39Z")

</div>

Hi @Yuri9447,

I have the same Problem while creating a Blank Plugin.

Where can I find this File? Where can I add this Code?

Can you guide me? I am at the Learning stage!

---

<div class="post-metadata">

**Author:** ![Yuri9447](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Yuri9447](https://forums.unrealengine.com/u/Yuri9447)\
**Post date:** [June 29, 2023, 11:38am UTC](https://forums.unrealengine.com/t/unreal-build-tool-error-ubt-error-unhandled-exception-system-argumentnullexception-value-cannot-be-null/469851/5 "2023-06-29T11:38:43Z")

</div>

@Jemish7120 I just added an environment variable. On Windows platform, I added this environment variable to the system variables. The Name is ComSpec and the value is “C:\Windows\system32\cmd.exe”.
