Assertion failed when cooking content for WindowsServer

Hi. Two things:

  1. Can you post the server target file?
  2. What are you using to build the server?

If I cook (or package) my project using the default (game) configuration, all is fine.

However, if I cook for configuration “WindowsServer” with UE 4.18.2, an Assertion Failure occurs, and the process is aborted. Cooking for dedicated server is required for blueprint nativization, so I cannot skip this. I use the following command line, which worked fine for me using UE 4.18.0:

"D:\Games\Unreal Launcher\Epic Games\UE_source\Engine\Binaries\Win64\UE4Editor-Cmd.exe" D:\Projects\Unreal\TestProject\TestProject.uproject -run=Cook  -NoLogTimes -TargetPlatform=WindowsServer -fileopenlog -unversioned -stdout -CrashForUAT -unattended  -UTF8Output

Building the server (without cooking) works fine, but the result will not run due to missing BP nativized assets.
Anyway, the assertion also occurs if I disable Blueprint nativization.

This is the relevant part of the log:

LogTargetPlatformManager: Display: Building Assets For WindowsServer
LogWindows: Error: begin: stack for UAT
LogWindows: Error: === Critical error: ===
LogWindows: Error: 
LogWindows: Error: Assertion failed: PlatformFormats.Num() [File:D:\Games\Unreal Launcher\Epic Games\UE_source\Engine\Source\Runtime\Engine\Private\TextureDerivedData.cpp] [Line: 371] 
LogWindows: Error: 
LogWindows: Error: 
LogWindows: Error: 
LogWindows: Error: [Callstack] 0x000000003FA13FB8 KERNELBASE.dll!UnknownFunction []
LogWindows: Error: [Callstack] 0x00000000315870E4 UE4Editor-ApplicationCore.dll!FWindowsErrorOutputDevice::Serialize() [d:\games\unreal launcher\epic games\ue_source\engine\source\runtime\applicationcore\private\windows\windowserroroutputdevice.cpp:65]
LogWindows: Error: [Callstack] 0x000000000BC478FB UE4Editor-Core.dll!FOutputDevice::Logf__VA() [d:\games\unreal launcher\epic games\ue_source\engine\source\runtime\core\private\misc\outputdevice.cpp:70]
LogWindows: Error: [Callstack] 0x000000000BBD9988 UE4Editor-Core.dll!FDebug::AssertFailed() [d:\games\unreal launcher\epic games\ue_source\engine\source\runtime\core\private\misc\assertionmacros.cpp:414]
LogWindows: Error: [Callstack] 0x00000000F9A62BF8 UE4Editor-Engine.dll!GetBuildSettingsForRunningPlatform() [d:\games\unreal launcher\epic games\ue_source\engine\source\runtime\engine\private\texturederiveddata.cpp:372]
LogWindows: Error: [Callstack] 0x00000000F9A52D15 UE4Editor-Engine.dll!UTexture::CachePlatformData() [d:\games\unreal launcher\epic games\ue_source\engine\source\runtime\engine\private\texturederiveddata.cpp:1088]
LogWindows: Error: [Callstack] 0x00000000F9A819A9 UE4Editor-Engine.dll!UTexture2D::Serialize() [d:\games\unreal launcher\epic games\ue_source\engine\source\runtime\engine\private\texture2d.cpp:249]
LogWindows: Error: [Callstack] 0x000000000B66AF60 UE4Editor-CoreUObject.dll!FLinkerLoad::Preload() [d:\games\unreal launcher\epic games\ue_source\engine\source\runtime\coreuobject\private\uobject\linkerload.cpp:3300]
LogWindows: Error: [Callstack] 0x000000000B74B179 UE4Editor-CoreUObject.dll!EndLoad() [d:\games\unreal launcher\epic games\ue_source\engine\source\runtime\coreuobject\private\uobject\uobjectglobals.cpp:1554]
LogWindows: Error: [Callstack] 0x000000000B75E789 UE4Editor-CoreUObject.dll!LoadPackageInternal() [d:\games\unreal launcher\epic games\ue_source\engine\source\runtime\coreuobject\private\uobject\uobjectglobals.cpp:1333]
LogWindows: Error: [Callstack] 0x000000000B75DBE0 UE4Editor-CoreUObject.dll!LoadPackage() [d:\games\unreal launcher\epic games\ue_source\engine\source\runtime\coreuobject\private\uobject\uobjectglobals.cpp:1430]
LogWindows: Error: [Callstack] 0x000000000B7731F7 UE4Editor-CoreUObject.dll!ResolveName() [d:\games\unreal launcher\epic games\ue_source\engine\source\runtime\coreuobject\private\uobject\uobjectglobals.cpp:798]
LogWindows: Error: [Callstack] 0x000000000B77C144 UE4Editor-CoreUObject.dll!StaticLoadObjectInternal() [d:\games\unreal launcher\epic games\ue_source\engine\source\runtime\coreuobject\private\uobject\uobjectglobals.cpp:886]
LogWindows: Error: [Callstack] 0x000000000B77B8E5 UE4Editor-CoreUObject.dll!StaticLoadObject() [d:\games\unreal launcher\epic games\ue_source\engine\source\runtime\coreuobject\private\uobject\uobjectglobals.cpp:953]
LogWindows: Error: [Callstack] 0x00000000F9AFE50E UE4Editor-Engine.dll!LoadSpecialMaterial() [d:\games\unreal launcher\epic games\ue_source\engine\source\runtime\engine\private\unrealengine.cpp:1811]
LogWindows: Error: [Callstack] 0x00000000F9AF6E34 UE4Editor-Engine.dll!UEngine::InitializeObjectReferences() [d:\games\unreal launcher\epic games\ue_source\engine\source\runtime\engine\private\unrealengine.cpp:1887]
LogWindows: Error: [Callstack] 0x00000000F75382FF UE4Editor-UnrealEd.dll!UEditorEngine::InitializeObjectReferences() [d:\games\unreal launcher\epic games\ue_source\engine\source\editor\unrealed\private\editorengine.cpp:809]
LogWindows: Error: [Callstack] 0x00000000F9AF226A UE4Editor-Engine.dll!UEngine::Init() [d:\games\unreal launcher\epic games\ue_source\engine\source\runtime\engine\private\unrealengine.cpp:1205]
LogWindows: Error: [Callstack] 0x00000000F75378A5 UE4Editor-UnrealEd.dll!UEditorEngine::InitEditor() [d:\games\unreal launcher\epic games\ue_source\engine\source\editor\unrealed\private\editorengine.cpp:575]
LogWindows: Error: [Callstack] 0x00000000921EC589 UE4Editor-Cmd.exe!FEngineLoop::PreInit() [d:\games\unreal launcher\epic games\ue_source\engine\source\runtime\launch\private\launchengineloop.cpp:2115]
LogWindows: Error: [Callstack] 0x00000000921E3EA7 UE4Editor-Cmd.exe!GuardedMain() [d:\games\unreal launcher\epic games\ue_source\engine\source\runtime\launch\private\launch.cpp:127]
LogWindows: Error: [Callstack] 0x00000000921E410A UE4Editor-Cmd.exe!GuardedMainWrapper() [d:\games\unreal launcher\epic games\ue_source\engine\source\runtime\launch\private\windows\launchwindows.cpp:134]
LogWindows: Error: [Callstack] 0x00000000921F1C5B UE4Editor-Cmd.exe!WinMain() [d:\games\unreal launcher\epic games\ue_source\engine\source\runtime\launch\private\windows\launchwindows.cpp:210]
LogWindows: Error: [Callstack] 0x00000000921F2B0B UE4Editor-Cmd.exe!__scrt_common_main_seh() [f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:283]
LogWindows: Error: [Callstack] 0x0000000041DB1FE4 KERNEL32.DLL!UnknownFunction []
LogWindows: Error: [Callstack] 0x0000000042F8EF91 ntdll.dll!UnknownFunction []
LogWindows: Error: [Callstack] 0x0000000042F8EF91 ntdll.dll!UnknownFunction []
LogWindows: Error: 
LogWindows: Error: end: stack for UAT

Unfortunately, I cannot reproduce this bug with a minimal project. Is there anything I can do to help you recreate this issue?

This bug occurs for me using UE 4.18.2 built with Visual Studio 2017 15.4.4. For me it is a regression against UE 4.18.0, but since I renamed a lot of assets in the meantime I cannot entirely rule out side effects.

Hi Jin_VE,

  1. This is the server target file (it worked fine using 4.18.0):

    using UnrealBuildTool;
    using System.Collections.Generic;

    [SupportedPlatforms(UnrealPlatformClass.Server)]
    public class TestProjectServerTarget : TargetRules
    {
    public TestProjectServerTarget(TargetInfo Target) : base(Target)
    {
    Type = TargetType.Server;

         ExtraModuleNames.AddRange(new string[] { "TestProject" });
     }
    

    }

  2. Do you mean which development environment? See above, VS 2017 15.4.4. Please note, however, that building the server works fine, only cooking for the server fails.

See the UE4Editor-Cmd.exe command line in the original post. This is the cook command.

Side note: The same issue occurs if I use the frontend tool (UnrealFrontend.exe). So thanks for the hint!

Yeah but how are you cooking it? The Frontend tool?

The target file looks fine.

Oh. Right. Can’t help with that part but I can give you an alternative. It’s how I build my servers. I’ll put it in an answer now.

Thank you for the hints, unfortunately this did not help.
I have deleted the folders .vs, Binaries, Build, DerivedDataCache, Intermediate, Saved. Then I reopened the project, packaged the game (successful), then cooked the server - same Assertion failure as above. Same result using frontend tool.

So there is no workaround available :-(.

Well I was going to suggest using the frontend tool. If you want to try my settings, here they are.

But you say you tried it so my only thought is to try a clean build. No intermediate directories.

Are you using the engine source from Github?

Yes, without any modifications.

You put the github source in “D:\Games\Unreal Launcher\Epic Games\UE_source”? That’s confusing. :slight_smile:

The failure seems to be coming from the derived data cache. Sometimes UE4 copies that and sometimes it generates it. After you cleaned the project directories and built/ran the editor, does it take a while to load while it builds the shaders? Also, did you re-generate project files? What about changing the engine version?

It might make sense if it was getting confused and using the old 4.18.0 cache for the new 4.18.2 engine. In that case, as a last resort you’d want to do a fresh install of UE4 and make sure you don’t put it in the same directory.

The asset causing this issue was “InvalidLightmapSettings” (I found out through debugging UE4-EditorCmd). Since this is provided by UE4, I followed your hint to rebuild the engine in a different folder.
A fresh git clone of UE 4.18.2 and building it in a new directory actually fixed the issue. I still think that this error handling needs to be improved, but from now on I will rebuild UE4 in new folders even for minor releases. Thanks!

I encountered the same issue today, server build failing due to an assertion error at texturederiveddata.cpp:371. The UE I used when the error started appearing was 4.18.0 built from source.

I see you are using VS2017. So am I since two days. I suspect VS2017 or MSBuild 15 may be an issue, since the error appeared a day after I switched from building the engine with VS2015 to VS2017. I will be reverting to VS2015 and try again. It will take all day, but I wanted to let you know that you’re not the only (recent) person with this issue.

Well I can confirm it works fine using VS2017, after completely rebuilding the engine in a different folder.

Downgrading to VS2015 didn’t solve the issue for me either. Neither did cleaning the project folder (deleting Binaries, Intermediate, DerivedDataCache, Saved). But deleting the engine’s Binaries, Intermediate, DerivedDataCache and Saved folders did help! (You do have to redownload some files from the Saved folder from git.)

As a side note, I learned from debugging that UE_SERVER was not properly set to 1 during the dedicated server build, causing the textures to be built while there rendering hardware interface (RHI) associated with the target platform, causing an assertion to fail (and rightly so). Something in the engine cache must have been causing UnrealBuildTool to not set UE_SERVER correctly. But again, cleaning the engine folders solved it for me.

I had encountered same issue.
I guess some plugins affected that.

If some plugins need AllowCommandletRendering flag, then they makes PRIVATE_GAllowCommandletRendering true.
So it forces cooking texture for server build.

To solve the problem simply remove the plugin, or use the whitelist or type setting to ignore it when building the server.