Oh ffs, how do you debug an UHT crash?

Another fun day doing UE4 stuff. I’ve got a lovely crash/assert in UHT.

Anyone got a good strategy for finding out why UHT is crashing when generating headers?

I was compiling fine yesterday, did some new class definition work today and voila! crash! only I can’t debug it, because there’s no useful bloody error messages… here’s what I get:

1>  Parsing headers for GroundBranchEditor
1>  D:/Ground Branch/GroundBranch/Source/GroundBranch/Public/AI/GBAIController.h(10) : LogWindows:Error: Windows GetLastError: The operation completed successfully. (0)
1>Error : Failed to generate code for GroundBranchEditor - error code: CrashOrAssert (3)
1>  UnrealHeaderTool failed for target 'GroundBranchEditor' (platform: Win64, module info: D:\Ground Branch\GroundBranch\Intermediate\Build\Win64\GroundBranchEditor\DebugGame\UnrealHeaderTool.manifest).
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.MakeFile.Targets(38,5): error MSB3073: The command ""D:\Epic Games\4.8\Engine\Build\BatchFiles\Build.bat" GroundBranchEditor Win64 DebugGame "D:\Ground Branch\GroundBranch\GroundBranch.uproject" -rocket" exited with code -1.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 1 skipped ==========

Don’t bother about the GBAIController.h that isn’t the problem, that’s been fine forever. Something else is breaking it all.

So please, have mercy on me and give me an idea how to debug this kind of thing. I really don’t want to have to debug UHT, but you know I will if I have to.


You can check this post by robert.manuszewski for how to debug UHT

So it seems this is an assertion rather than a crash:

>Assertion failed: Class->Children == NULL [File:D:\BuildFarm\buildmachine_++depot+UE4-Releases+4.8\Engine\Source\Programs\UnrealHeaderTool\Private\HeaderParser.cpp] [Line: 4430]

So my question becomes… wtf does this assertion actually check for? I mean the code is thus:

// Verify class variables haven’t been filled in
check(Class->Children == NULL);

But what variables are we talking about? Anyone know what might be causing this? What are the children actually? How could they be non-null? Does this mean it must be a duplicate class declaration? Or some kind of circular dependency? Why isn’t there some kind of decent error code being emitted here instead of a completely useless assertion?

Well if it’s an assertion failure then it’s something they didn’t expect should happen, so didn’t pass it through as an error to output to the user. Which isn’t much help to you now, since clearly, it is happening.

I’d suggest rather than jumping into debugging UHT, first just try commenting out various bits of reflection-related code in GBAIController.h and see if you can get it to compile. That should help you narrow down the cause.

So it turns out, I’d updated the project from svn and that had reinstated a deleted directory from a move when another programmer moved stuff from /Classes/ to /Private/ and of course both of the classes were being generated, only the UHT isn’t smart enough to actually give an error that it had seen that class before somewhere.

You can’t make this s…t up.

i have similar issues like this many times , “Generate Visual Studio Project” is my friend now

I just ran into this same issue. I had AMyGameMode in defined in two different files. Deleted one of them and it builds again.

Thanks that solved my issue here too :slight_smile: