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

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:

    3> [19382/19391] UE4Editor-UnrealEd.dll
    3> Creating library D:\Hero4.25\Engine\Intermediate\Build\Win64\UE4Editor\Development\UnrealEd\UE4Editor-UnrealEd.suppressed.lib and object D:\Hero4.25\Engine\Intermediate\Build\Win64\UE4Editor\Development\UnrealEd\UE4Editor-UnrealEd.suppressed.exp
    3>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.MakeFile.Targets(46,5): error MSB3073: The command “C:\Windows\System32\chcp.com 65001 >NUL
    3>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.MakeFile.Targets(46,5): error MSB3073: …\Build\BatchFiles\Build.bat -Target=“UE4Editor Win64 Development” -Target=“ShaderCompileWorker Win64 Development -Quiet” -WaitMutex -FromMsBuild” exited with code 6.
    3>Done building project “UE4.vcxproj” – FAILED.

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


And on Windows platform, it says to get the shell by environment variable “ComSpec”.

So I added this environment variable and problem solved. Hope this can help you!

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!

@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”.