UnrealBuildTool fails with null argument

After upgrading my project to 4.17 it’s started occasionally failing to compile because UnrealBuildTool encounters a System.ArgumentNullException when it tries to run. The full callstack is:

2>EXEC : error : System.ArgumentNullException: Value cannot be null.
2>  Parameter name: source
2>     at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate)
2>     at UnrealBuildTool.ExternalExecution.ExecuteHeaderToolIfNecessary(BuildConfiguration BuildConfiguration, UEBuildTarget Target, CppCompileEnvironment GlobalCompileEnvironment, List`1 UObjectModules, FileReference ModuleInfoFileName, ECompilationResult& UHTResult)
2>     at UnrealBuildTool.UnrealBuildTool.RunUBT(BuildConfiguration BuildConfiguration, String[] Arguments, FileReference ProjectFile)

I don’t recall encountering this error while testing the preview but that may have simply been luck since I didn’t do more than occasionally make sure all my code still compiled and ran. Doing a full rebuild of my project fixes the error but I’d like to avoid having to do that if possible since it usually takes a few minutes.

Further testing finds that this only occurs when I change a header file. I made a new (blank) code project and encounter the exact same issue and tried it on a different machine so it doesn’t seem to be an issue with either my project or computer.

I’m also having this issue when changing a header.

It’s not a fix, but if you regenerate project files you can compile again.

I’m having the same issue.

The workaround I’ve used is to Rebuild/build clean - works as well.

I have the same issue after updating to 4.17.
I can confirm that both workarounds work, but it is quite cumbersome and time consuming to rebuild every time.

Best

Adding my own voice to this. Added two transient properties to a class header, and was hit by this exact build error. Clean and rebuild got me past it.

Yep, that did it. Didn’t think to check that part of the forums so thanks for the link.

Same error, when changing a .h file with UE 4.18p1.