Crash when building hlods for levels with Level Script Actors

Distributed HLod builds will crash during the builder stage if the target level has a Level Script actor with any modifications.

To repro:

1) Create a new Open world level

2) Add something which will be used for an hlod build (Eg landscape)

3) Add a variable to the Level Script Actor

4) Save and close the editor

5) Run the distributed hlod setup commandlet; eg:

"C:\Program Files\Epic Games\UE_5.7\Engine\Binaries\ThirdParty\DotNet\8.0.412\win-x64\dotnet.exe" "C:\Program Files\Epic Games\UE_5.7\Engine\Binaries\DotNET\AutomationTool\AutomationTool.dll" -nop4 -NoCompile WorldPartitionBuilder -Project=E:\samples\ContentExamples_5.7\data\ContentExamples.uproject -Builder=WorldPartitionHLODsBuilder -CommandletArgs="/Game/Developers/user/NewMap.NewMap -DistributedBuild -SCCProvider=None -AllowCommandletRendering -SetupHLODs -BuilderCount=10"

6) Run a distributed hlod builder step commandlet; eg:

"C:\Program Files\Epic Games\UE_5.7\Engine\Binaries\ThirdParty\DotNet\8.0.412\win-x64\dotnet.exe" "C:\Program Files\Epic Games\UE_5.7\Engine\Binaries\DotNET\AutomationTool\AutomationTool.dll" -nop4 -NoCompile WorldPartitionBuilder -Project=E:\samples\ContentExamples_5.7\data\ContentExamples.uproject -Builder=WorldPartitionHLODsBuilder -CommandletArgs="/Game/Developers/user/NewMap.NewMap -DistributedBuild -SCCProvider=None -AllowCommandletRendering -BuildHLODs -BuilderIdx=0"

Observe the crash.

[Attachment Removed]

Stack trace

LogWindows: Error: begin: stack for UAT
LogWindows: Error: === Critical error: ===
LogWindows: Error:
LogWindows: Error: Assertion failed:  [File:D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp] [Line: 5032]
LogWindows: Error: E:\samples\ContentExamples_5.7\data\Content\Developers\user\NewMap.umap: REINST_NewMap_C_0 /Engine/Transient.Default__NewMap_C: Serial size mismatch: Got 13, Expected 9
LogWindows: Error:
LogWindows: Error:
LogWindows: Error: [Callstack] 0x00007ff8851a73fa KERNELBASE.dll!UnknownFunction []
LogWindows: Error: [Callstack] 0x00007fff6d7628d4 UnrealEditor-Core.dll!ReportAssert() [D:\build\++UE5\Sync\Engine\Source\Runtime\Core\Private\Windows\WindowsPlatformCrashContext.cpp:1954]
LogWindows: Error: [Callstack] 0x00007fff6d765c36 UnrealEditor-Core.dll!FWindowsErrorOutputDevice::Serialize() [D:\build\++UE5\Sync\Engine\Source\Runtime\Core\Private\Windows\WindowsErrorOutputDevice.cpp:85]
LogWindows: Error: [Callstack] 0x00007fff6d574852 UnrealEditor-Core.dll!FOutputDevice::LogfImpl() [D:\build\++UE5\Sync\Engine\Source\Runtime\Core\Private\Misc\OutputDevice.cpp:81]
LogWindows: Error: [Callstack] 0x00007fff6d4971b7 UnrealEditor-Core.dll!AssertFailedImplV() [D:\build\++UE5\Sync\Engine\Source\Runtime\Core\Private\Misc\AssertionMacros.cpp:175]
LogWindows: Error: [Callstack] 0x00007fff6d4970d0 UnrealEditor-Core.dll!FDebug::AssertFailed() [D:\build\++UE5\Sync\Engine\Source\Runtime\Core\Private\Misc\AssertionMacros.cpp:755]
LogWindows: Error: [Callstack] 0x00007fff82c15502 UnrealEditor-CoreUObject.dll!FLinkerLoad::Preload() [D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:5032]
LogWindows: Error: [Callstack] 0x00007fff82965133 UnrealEditor-CoreUObject.dll!FLinkerLoad::ResolveDeferredExports() [D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\Blueprint\BlueprintSupport.cpp:2299]
LogWindows: Error: [Callstack] 0x00007fff8293b90f UnrealEditor-CoreUObject.dll!FLinkerLoad::FinalizeBlueprint() [D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\Blueprint\BlueprintSupport.cpp:2053]
LogWindows: Error: [Callstack] 0x00007fff82c1526e UnrealEditor-CoreUObject.dll!FLinkerLoad::Preload() [D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:5000]
LogWindows: Error: [Callstack] 0x00007fff82befae8 UnrealEditor-CoreUObject.dll!FLinkerLoad::CreateExport() [D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:5819]
LogWindows: Error: [Callstack] 0x00007fff82f0babc UnrealEditor-CoreUObject.dll!FAsyncPackage2::CreateLinkerLoadExports() [D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\Serialization\AsyncLoading2.cpp:7412]
LogWindows: Error: [Callstack] 0x00007fff82f13520 UnrealEditor-CoreUObject.dll!FAsyncPackage2::Event_CreateLinkerLoadExports() [D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\Serialization\AsyncLoading2.cpp:7596]
LogWindows: Error: [Callstack] 0x00007fff82f173ab UnrealEditor-CoreUObject.dll!FEventLoadNode2::Execute() [D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\Serialization\AsyncLoading2.cpp:5979]
LogWindows: Error: [Callstack] 0x00007fff82f188c8 UnrealEditor-CoreUObject.dll!FAsyncLoadEventQueue2::ExecuteSyncLoadEvents() [D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\Serialization\AsyncLoading2.cpp:6186]
LogWindows: Error: [Callstack] 0x00007fff82f27c3c UnrealEditor-CoreUObject.dll!FAsyncLoadingThread2::ProcessAsyncLoadingFromGameThread() [D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\Serialization\AsyncLoading2.cpp:9858]
LogWindows: Error: [Callstack] 0x00007fff82f375ec UnrealEditor-CoreUObject.dll!FAsyncLoadingThread2::TickAsyncLoadingFromGameThread() [D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\Serialization\AsyncLoading2.cpp:10203]
LogWindows: Error: [Callstack] 0x00007fff82f1ae70 UnrealEditor-CoreUObject.dll!FAsyncLoadingThread2::FlushLoading() [D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\Serialization\AsyncLoading2.cpp:11909]
LogWindows: Error: [Callstack] 0x00007fff82a09349 UnrealEditor-CoreUObject.dll!FlushAsyncLoading() [D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\Serialization\AsyncPackageLoader.cpp:354]
LogWindows: Error: [Callstack] 0x00007fff82a0902c UnrealEditor-CoreUObject.dll!FlushAsyncLoading() [D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\Serialization\AsyncPackageLoader.cpp:323]
LogWindows: Error: [Callstack] 0x00007fff82e36b4d UnrealEditor-CoreUObject.dll!LoadPackageInternal() [D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectGlobals.cpp:1715]
LogWindows: Error: [Callstack] 0x00007fff82e35e35 UnrealEditor-CoreUObject.dll!LoadPackage() [D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectGlobals.cpp:2079]
LogWindows: Error: [Callstack] 0x00007fff82e3640d UnrealEditor-CoreUObject.dll!LoadPackage() [D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectGlobals.cpp:2055]
LogWindows: Error: [Callstack] 0x00007fff64558fd8 UnrealEditor-Engine.dll!FWorldPartitionLevelHelper::LoadActorsInternal() [D:\build\++UE5\Sync\Engine\Source\Runtime\Engine\Private\WorldPartition\WorldPartitionLevelHelper.cpp:957]
LogWindows: Error: [Callstack] 0x00007fff64559840 UnrealEditor-Engine.dll!FWorldPartitionLevelHelper::LoadActorsWithPropertyOverridesInternal() [D:\build\++UE5\Sync\Engine\Source\Runtime\Engine\Private\WorldPartition\WorldPartitionLevelHelper.cpp:514]
LogWindows: Error: [Callstack] 0x00007fff644a0a1b UnrealEditor-Engine.dll!UWorldPartitionHLODSourceActorsFromCell::LoadSourceActors() [D:\build\++UE5\Sync\Engine\Source\Runtime\Engine\Private\WorldPartition\HLOD\HLODSourceActorsFromCell.cpp:75]
LogWindows: Error: [Callstack] 0x0000022b60d23064 UnrealEditor-WorldPartitionHLODUtilities.dll!LoadSourceActors() [D:\build\++UE5\Sync\Engine\Plugins\Editor\WorldPartitionHLODUtilities\Source\Private\WorldPartition\HLOD\Utilities\WorldPartitionHLODUtilities.cpp:741]
LogWindows: Error: [Callstack] 0x0000022b60d181e5 UnrealEditor-WorldPartitionHLODUtilities.dll!FWorldPartitionHLODUtilities::BuildHLOD() [D:\build\++UE5\Sync\Engine\Plugins\Editor\WorldPartitionHLODUtilities\Source\Private\WorldPartition\HLOD\Utilities\WorldPartitionHLODUtilities.cpp:810]
LogWindows: Error: [Callstack] 0x00007fff643aa5bb UnrealEditor-Engine.dll!AWorldPartitionHLOD::BuildHLOD() [D:\build\++UE5\Sync\Engine\Source\Runtime\Engine\Private\WorldPartition\HLOD\HLODActor.cpp:611]
LogWindows: Error: [Callstack] 0x00007fff610c8a36 UnrealEditor-UnrealEd.dll!UWorldPartitionHLODsBuilder::BuildHLODActors() [D:\build\++UE5\Sync\Engine\Source\Editor\UnrealEd\Private\WorldPartition\WorldPartitionHLODsBuilder.cpp:675]
LogWindows: Error: [Callstack] 0x00007fff610f786d UnrealEditor-UnrealEd.dll!UWorldPartitionHLODsBuilder::RunInternal() [D:\build\++UE5\Sync\Engine\Source\Editor\UnrealEd\Private\WorldPartition\WorldPartitionHLODsBuilder.cpp:350]
LogWindows: Error: [Callstack] 0x00007fff610f50ff UnrealEditor-UnrealEd.dll!UWorldPartitionBuilder::Run() [D:\build\++UE5\Sync\Engine\Source\Editor\UnrealEd\Private\WorldPartition\WorldPartitionBuilder.cpp:298]
LogWindows: Error: [Callstack] 0x00007fff610f6a78 UnrealEditor-UnrealEd.dll!UWorldPartitionBuilder::RunBuilder() [D:\build\++UE5\Sync\Engine\Source\Editor\UnrealEd\Private\WorldPartition\WorldPartitionBuilder.cpp:131]
LogWindows: Error: [Callstack] 0x00007fff60148be7 UnrealEditor-UnrealEd.dll!UWorldPartitionBuilderCommandlet::RunBuilder() [D:\build\++UE5\Sync\Engine\Source\Editor\UnrealEd\Private\Commandlets\WorldPartitionBuilderCommandlet.cpp:297]
LogWindows: Error: [Callstack] 0x00007fff6012e89d UnrealEditor-UnrealEd.dll!UWorldPartitionBuilderCommandlet::Main() [D:\build\++UE5\Sync\Engine\Source\Editor\UnrealEd\Private\Commandlets\WorldPartitionBuilderCommandlet.cpp:193]
LogWindows: Error: [Callstack] 0x00007ff7401ea5d1 UnrealEditor-Cmd.exe!FEngineLoop::PreInitPostStartupScreen() [D:\build\++UE5\Sync\Engine\Source\Runtime\Launch\Private\LaunchEngineLoop.cpp:4053]
LogWindows: Error: [Callstack] 0x00007ff7401e0a1b UnrealEditor-Cmd.exe!GuardedMain() [D:\build\++UE5\Sync\Engine\Source\Runtime\Launch\Private\Launch.cpp:146]
LogWindows: Error: [Callstack] 0x00007ff7401e0d0a UnrealEditor-Cmd.exe!GuardedMainWrapper() [D:\build\++UE5\Sync\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:123]
LogWindows: Error: [Callstack] 0x00007ff7401e4590 UnrealEditor-Cmd.exe!LaunchWindowsStartup() [D:\build\++UE5\Sync\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:277]
LogWindows: Error: [Callstack] 0x00007ff7401f5be4 UnrealEditor-Cmd.exe!WinMain() [D:\build\++UE5\Sync\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:334]
LogWindows: Error: [Callstack] 0x00007ff7401f82f6 UnrealEditor-Cmd.exe!__scrt_common_main_seh() [D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288]
LogWindows: Error: [Callstack] 0x00007ff8861be8d7 KERNEL32.DLL!UnknownFunction []
LogWindows: Error:
LogWindows: Error: end: stack for UAT
Took 16.17s to run UnrealEditor-Cmd.exe, ExitCode=3

[Attachment Removed]

I’m curious if there is any suggested fix for this issue?

[Attachment Removed]

Getting the same error when building HLODs for one of our maps (started occurring after updating from UE 5.6 to 5.7.4).

[Attachment Removed]

Just sharing some findings:

the discrepancy comes from `UBlueprintGneratedClass::SerializeDefaultObject`, it overrides `UClass::SerializeDefaultObject`, the parent class is where the `MarkScriptSerializationStart/End` functions record the offsets, but the BPGC override writes another pointer after the Super call:

Super::SerializeDefaultObject(Object, Slot);   // ← script marks placed here (66 bytes)
  // ...
  UnderlyingArchive << SerializedSparseClassDataStruct;  // ← +4 bytes AFTER marks

so that pointer’s size is tracked by the actual SerialSize but not the offsets. UBlueprintGeneratedClass is the only class doing this.

When the BP has meaningful content, the BP will be recompiled regardless on load, no matter if there’s any change, and recompile of the BP will change the UClass associated with the CDO during loading and force the Engine to take the code path to check the SerialSize and ExpectedSize, if the UClass doesn’t change, it goes another code path that skips the check. Info below from Claude, I didn’t verify it thoroughly but it looks reasonable:

A Blueprint is **skipped** (no bytecode compile) if ALL of these are true:
  - The generated class exists and its super matches the BP's `ParentClass`
  - It's a **data-only Blueprint** (`FBlueprintEditorUtils::IsDataOnlyBlueprint`)
->- no graphs, no new code
  - `bHasBeenRegenerated` is false (hasn't already been regenerated this session)
  - It has a valid linker (was loaded from disk, not created in-memory)
  - No default scene component needs to be added
  - No pending UberGraphFrame
  - **Either** the parent is a native class, **or** the current class layout matches its super struct (`FStructUtils::TheSameLayout`)
If any of those conditions fail, the Blueprint gets a **full recompile**.

[Attachment Removed]

Added a barebone repro project created with UE 5.7.4 from Epic launcher. Just run the following builder to see the crash

UnrealEditor-Cmd.exe "D:\HLODCrash\HLODCrash.uproject" NewMap -run=WorldPartitionBuilder -Builder=WorldPartitionHLODsBuilder -unattended -AllowCommandletRendering -NoRayTracing -BuildHLODLayer=NewMap_HLOD0_Instancing

[Attachment Removed]

Hey everyone. Thank you for the repro steps and the repro project. This one took a while to investigate, but I can indeed confirm that WorldPartitionHLODsBuilder broke in 5.7 and also that it will be fixed in 5.8. The fix itself is very cherrypickable and is just two lines of code.

CL 48781367 introduced a change to how the commandlet creates a temporary editor world for HLOD building. This rolled out into UE 5.7 and introduced the regression.

CL 48865483 fixes it. I’ve confirmed that cherrypicking that into UE 5.7 solves the HLOD building crash and lets the commandlet run to completion.

Here is the associated github commit for the fix to cherrypick: e5532c179c55f75a388d057039fe26caa4c117a4.

Anyone here who was affected by this bug, please confirm whether cherrypicking that also fixes things on your end.

[Attachment Removed]

That’s great to hear!

[Attachment Removed]

On our end adding a garbage collect step between the HLOD_Setup and the HLOD_Build steps fixed the issue (so far). Via FWorldPartitionHelpers::DoCollectGarbage(). Note that our case is different than yours as we’re not doing a distributed build, but are using a custom UWorldPartitionHLODsBuilder.

[Attachment Removed]

I tried sprinkling that call around the builder and didn’t get any further progress.

[Attachment Removed]

Sorry it didn’t help. Thanks for the info though.

[Attachment Removed]

I can confirm the crash is fixed with this patch, thank you!!

[Attachment Removed]