Need help diagnosing: UE_SERVER evaluates to 0 while building dedicated server

Hello everyone,

I’m encountering a problem while building a dedicated server. This is the command I use, which has been working for months and months:



C:/Projects/UnrealEngine/Engine/Build/BatchFiles/RunUAT" BuildCookRun -project="GameName.uproject" -noP4 -platform=Win64 -serverconfig=Development -build -cook -server -serverplatform=Win64 -noclient -stage


Since yesterday our builds have been failing due to an assertion error. This is the relevant part of the log:



LogTargetPlatformManager: Display: Building Assets For WindowsServer
LogOnline: Display: STEAM: Loading Steam SDK 1.39
LogWindows: Warning: CreateProc failed: The system cannot find the file specified. (0x00000002)
LogWindows: Warning: URL: ../../../Engine/Binaries/Win64/CrashReportClient.exe "D:/Jenkins/workspace/GameNameShared/GameNameV2/Saved/Crashes/UE4CC-Windows-D873C232401D740DC5028687F1FFFC1F_0000" -Unattended -AppName=UE4-GameNameV2 -CrashGUID=UE4CC-Windows-D873C232401D740DC5028687F1FFFC1F_0000 -DebugSymbols=..\..\..\Engine\Intermediate\Symbols
LogWindows: Error: begin: stack for UAT
LogWindows: Error: === Critical error: ===
LogWindows: Error:
LogWindows: Error: Assertion failed: PlatformFormats.Num() [File:C:\Projects\UnrealEngine\Engine\Source\Runtime\Engine\Private\TextureDerivedData.cpp] [Line: 371]
LogWindows: Error:
LogWindows: Error:
LogWindows: Error:
LogWindows: Error: [Callstack] 0x00000000059B3FB8 KERNELBASE.dll!UnknownFunction ]
LogWindows: Error: [Callstack] 0x00000000E4B26E84 UE4Editor-ApplicationCore.dll!FWindowsErrorOutputDevice::Serialize() [c:\projects\unrealengine\engine\source\runtime\applicationcore\private\windows\windowserroroutputdevice.cpp:65]
LogWindows: Error: [Callstack] 0x00000000D707657B UE4Editor-Core.dll!FOutputDevice::Logf__VA() [c:\projects\unrealengine\engine\source\runtime\core\private\misc\outputdevice.cpp:70]
LogWindows: Error: [Callstack] 0x00000000D7005BAB UE4Editor-Core.dll!FDebug::AssertFailed() [c:\projects\unrealengine\engine\source\runtime\core\private\misc\assertionmacros.cpp:414]
LogWindows: Error: [Callstack] 0x00000000C4E013D9 UE4Editor-Engine.dll!GetBuildSettingsForRunningPlatform() [c:\projects\unrealengine\engine\source\runtime\engine\private	exturederiveddata.cpp:372]
LogWindows: Error: [Callstack] 0x00000000C4DF007F UE4Editor-Engine.dll!UTexture::CachePlatformData() [c:\projects\unrealengine\engine\source\runtime\engine\private	exturederiveddata.cpp:1088]
LogWindows: Error: [Callstack] 0x00000000C4E1E217 UE4Editor-Engine.dll!UTexture2D::Serialize() [c:\projects\unrealengine\engine\source\runtime\engine\private	exture2d.cpp:249]
LogWindows: Error: [Callstack] 0x00000000D6A84F39 UE4Editor-CoreUObject.dll!FLinkerLoad::Preload() [c:\projects\unrealengine\engine\source\runtime\coreuobject\private\uobject\linkerload.cpp:3300]
LogWindows: Error: [Callstack] 0x00000000D6B92B99 UE4Editor-CoreUObject.dll!EndLoad() [c:\projects\unrealengine\engine\source\runtime\coreuobject\private\uobject\uobjectglobals.cpp:1554]
LogWindows: Error: [Callstack] 0x00000000D6BAA8FD UE4Editor-CoreUObject.dll!LoadPackageInternal() [c:\projects\unrealengine\engine\source\runtime\coreuobject\private\uobject\uobjectglobals.cpp:1333]
LogWindows: Error: [Callstack] 0x00000000D6BA9D3D UE4Editor-CoreUObject.dll!LoadPackage() [c:\projects\unrealengine\engine\source\runtime\coreuobject\private\uobject\uobjectglobals.cpp:1430]
LogWindows: Error: [Callstack] 0x00000000D6BC22D8 UE4Editor-CoreUObject.dll!ResolveName() [c:\projects\unrealengine\engine\source\runtime\coreuobject\private\uobject\uobjectglobals.cpp:798]
LogWindows: Error: [Callstack] 0x00000000D6BCD470 UE4Editor-CoreUObject.dll!StaticLoadObjectInternal() [c:\projects\unrealengine\engine\source\runtime\coreuobject\private\uobject\uobjectglobals.cpp:886]
LogWindows: Error: [Callstack] 0x00000000D6BCCC05 UE4Editor-CoreUObject.dll!StaticLoadObject() [c:\projects\unrealengine\engine\source\runtime\coreuobject\private\uobject\uobjectglobals.cpp:953]
LogWindows: Error: [Callstack] 0x00000000C4EA599E UE4Editor-Engine.dll!LoadSpecialMaterial() [c:\projects\unrealengine\engine\source\runtime\engine\private\unrealengine.cpp:1811]
LogWindows: Error: [Callstack] 0x00000000C4E9B3E4 UE4Editor-Engine.dll!UEngine::InitializeObjectReferences() [c:\projects\unrealengine\engine\source\runtime\engine\private\unrealengine.cpp:1887]
LogWindows: Error: [Callstack] 0x00000000C2840C4F UE4Editor-UnrealEd.dll!UEditorEngine::InitializeObjectReferences() [c:\projects\unrealengine\engine\source\editor\unrealed\private\editorengine.cpp:809]
LogWindows: Error: [Callstack] 0x00000000C4E9663A UE4Editor-Engine.dll!UEngine::Init() [c:\projects\unrealengine\engine\source\runtime\engine\private\unrealengine.cpp:1205]
LogWindows: Error: [Callstack] 0x00000000C28401F5 UE4Editor-UnrealEd.dll!UEditorEngine::InitEditor() [c:\projects\unrealengine\engine\source\editor\unrealed\private\editorengine.cpp:575]
LogWindows: Error: [Callstack] 0x000000000B78CEB8 UE4Editor-Cmd.exe!FEngineLoop::PreInit() [c:\projects\unrealengine\engine\source\runtime\launch\private\launchengineloop.cpp:2115]
LogWindows: Error: [Callstack] 0x000000000B784765 UE4Editor-Cmd.exe!GuardedMain() [c:\projects\unrealengine\engine\source\runtime\launch\private\launch.cpp:127]
LogWindows: Error: [Callstack] 0x000000000B7849CA UE4Editor-Cmd.exe!GuardedMainWrapper() [c:\projects\unrealengine\engine\source\runtime\launch\private\windows\launchwindows.cpp:134]
LogWindows: Error: [Callstack] 0x000000000B79243E UE4Editor-Cmd.exe!WinMain() [c:\projects\unrealengine\engine\source\runtime\launch\private\windows\launchwindows.cpp:210]
LogWindows: Error: [Callstack] 0x000000000B7932FE UE4Editor-Cmd.exe!__scrt_common_main_seh() [f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:283]
LogWindows: Error: [Callstack] 0x0000000007F01FE4 KERNEL32.DLL!UnknownFunction ]
LogWindows: Error: [Callstack] 0x0000000008C6EF91 ntdll.dll!UnknownFunction ]
LogWindows: Error: [Callstack] 0x0000000008C6EF91 ntdll.dll!UnknownFunction ]
LogWindows: Error:
LogWindows: Error: end: stack for UAT
Took 67.1618132s to run UE4Editor-Cmd.exe, ExitCode=3
Cook failed. Deleting cooked data.
ERROR: Cook failed.
(see C:\Projects\UnrealEngine\Engine\Programs\AutomationTool\Saved\Logs\UAT_Log.txt for full exception trace)
AutomationTool exiting with ExitCode=25 (Error_UnknownCookFailure)
BUILD FAILED


The biggest hint for this failure is in TextureDerivedData.cpp, line 1088. This code should never be executed when building a dedicated server, since FApp::CanEverRender() should return false. Its implementation returns false right away if UE_SERVER is 1. But I found out that FApp::CanEverRender() actually returns true, and that UE_SERVER evaluates to 0 despite building a dedicated server. Notice even the log saying “Building assets for WindowsServer”.

I was hoping anyone has an idea that could explain UE_SERVER evaluating to 0 even though this is a dedicated server build. I’ve tried building this with VS2015 and VS2017, both give the same issue. I found this post about the same error, but its solution didn’t work for me: https://answers.unrealengine.com/que…-windowss.html

Normally UnrealBuildTool should add the preprocessor definition UE_SERVER=1. It does this in UEBuildServer.SetupDefaultGlobalEnvironment. However there is a fallback in Build.h which defines it as 0 unless it is already defined. Each target is built using the Build function called by UnrealBuildTool.RunUBT. Checked against the UE4.11 source.
You may need to debug UBT (don’t forget to set the commandline arguments when debugging) to find out why it doesn’t build it correctly anymore.

That’s very useful to know, thank you!

As for this particular issue, if anyone encounters this too, the problem got resolved by cleaning the engine source project’s Binaries, Intermediate, Saved and DerivedDataCache folders and then rebuilding the engine. Note that there are files in the Binaries folder that are part of the git repository, you’ll have to redownload those.

@UnrealEverything If this happens again, I’ll try to debug UBT as you suggested.