VR project Cooking/Packaging fails with String index out of bounds: Index 0 from a string with a length of 0

Hi, I’ve been working on a VR project for a while and I got to the point where I’m able to create a Demo build.

I went to try and package it, but each time I try it fails the Cooking process with this error:

UATHelper: Cooking (Windows):   LogCook: Display: Cooked packages 471 Packages Remain 280 Total 751
UATHelper: Cooking (Windows):   LogCook: Display: Cooked packages 476 Packages Remain 275 Total 751
UATHelper: Cooking (Windows):   LogCook: Display: Cooked packages 481 Packages Remain 270 Total 751
UATHelper: Cooking (Windows):   LogCook: Display: Cooked packages 485 Packages Remain 266 Total 751
UATHelper: Cooking (Windows):   LogCook: Display: Cooked packages 488 Packages Remain 263 Total 751
UATHelper: Cooking (Windows):   LogCook: Display: Cooked packages 496 Packages Remain 255 Total 751
UATHelper: Cooking (Windows):   LogCook: Display: Cooked packages 582 Packages Remain 166 Total 748
UATHelper: Cooking (Windows):   LogCook: Display: Cooked packages 734 Packages Remain 13 Total 747
UATHelper: Cooking (Windows):   LogCook: Display: Cooked packages 734 Packages Remain 13 Total 747
UATHelper: Cooking (Windows):   LogShaderCompilers: Error: SCW 10 Queued Jobs, Finished 9 single jobs
UATHelper: Cooking (Windows):   LogShaderCompilers: Error: Job 0 [Single] WorldGridMaterial/FTranslucentLightingInjectPS/8:/Engine/Private/TranslucentLightInjectionShaders.usf Type 'FTranslucentLightingInjectPS' '/Engine/Private/TranslucentLightInjectionShaders.usf' Entry 'InjectMainPS' Permutation 8
UATHelper: Cooking (Windows):   LogShaderCompilers: Error: Job 1 [Single] WorldGridMaterial/FTranslucentLightingInjectPS/7:/Engine/Private/TranslucentLightInjectionShaders.usf Type 'FTranslucentLightingInjectPS' '/Engine/Private/TranslucentLightInjectionShaders.usf' Entry 'InjectMainPS' Permutation 7
UATHelper: Cooking (Windows):   LogShaderCompilers: Error: Job 2 [Single] WorldGridMaterial/FTranslucentLightingInjectPS/5:/Engine/Private/TranslucentLightInjectionShaders.usf Type 'FTranslucentLightingInjectPS' '/Engine/Private/TranslucentLightInjectionShaders.usf' Entry 'InjectMainPS' Permutation 5
UATHelper: Cooking (Windows):   LogShaderCompilers: Error: Job 3 [Single] WorldGridMaterial/FTranslucentLightingInjectPS/3:/Engine/Private/TranslucentLightInjectionShaders.usf Type 'FTranslucentLightingInjectPS' '/Engine/Private/TranslucentLightInjectionShaders.usf' Entry 'InjectMainPS' Permutation 3
UATHelper: Cooking (Windows):   LogShaderCompilers: Error: Job 4 [Single] WorldGridMaterial/FTranslucentLightingInjectPS/1:/Engine/Private/TranslucentLightInjectionShaders.usf Type 'FTranslucentLightingInjectPS' '/Engine/Private/TranslucentLightInjectionShaders.usf' Entry 'InjectMainPS' Permutation 1
UATHelper: Cooking (Windows):   LogShaderCompilers: Error: Job 5: Pipeline DepthNoPixelPipeline
UATHelper: Cooking (Windows):   LogShaderCompilers: Error: PipelineJob 0 WorldGridMaterial/DepthNoPixelPipeline/TGPUSkinMorphVertexFactoryDefault/TDepthOnlyVS<false>/0:/Engine/Private/DepthOnlyVertexShader.usf VF 'TGPUSkinMorphVertexFactoryDefault' Type 'TDepthOnlyVS<false>' '/Engine/Private/DepthOnlyVertexShader.usf' Entry 'Main' Permutation 0
UATHelper: Cooking (Windows):   LogShaderCompilers: Error: Job 6: Pipeline VelocityPipeline
UATHelper: Cooking (Windows):   LogShaderCompilers: Error: PipelineJob 0 WorldGridMaterial/VelocityPipeline/TGPUSkinMorphVertexFactoryDefault/FVelocityPS/0:/Engine/Private/VelocityShader.usf VF 'TGPUSkinMorphVertexFactoryDefault' Type 'FVelocityPS' '/Engine/Private/VelocityShader.usf' Entry 'MainPixelShader' Permutation 0
UATHelper: Cooking (Windows):   LogShaderCompilers: Error: PipelineJob 1 WorldGridMaterial/VelocityPipeline/TGPUSkinMorphVertexFactoryDefault/FVelocityVS/0:/Engine/Private/VelocityShader.usf VF 'TGPUSkinMorphVertexFactoryDefault' Type 'FVelocityVS' '/Engine/Private/VelocityShader.usf' Entry 'MainVertexShader' Permutation 0
UATHelper: Cooking (Windows):   LogShaderCompilers: Error: Job 7 [Single] WorldGridMaterial/TGPUSkinMorphVertexFactoryDefault/FOnePassPointShadowDepthGS/0:/Engine/Private/ShadowDepthVertexShader.usf VF 'TGPUSkinMorphVertexFactoryDefault' Type 'FOnePassPointShadowDepthGS' '/Engine/Private/ShadowDepthVertexShader.usf' Entry 'MainOnePassPointLightGS' Permutation 0
UATHelper: Cooking (Windows):   LogShaderCompilers: Error: Job 8 [Single] WorldGridMaterial/TGPUSkinMorphVertexFactoryDefault/TBasePassVSFNoLightMapPolicy/0:/Engine/Private/BasePassVertexShader.usf VF 'TGPUSkinMorphVertexFactoryDefault' Type 'TBasePassVSFNoLightMapPolicy' '/Engine/Private/BasePassVertexShader.usf' Entry 'Main' Permutation 0
UATHelper: Cooking (Windows):   LogShaderCompilers: Error: Job 9 [Single] WorldGridMaterial/TGPUSkinMorphVertexFactoryDefault/TShadowDepthVSVertexShadowDepth_OnePassPointLight/0:/Engine/Private/ShadowDepthVertexShader.usf VF 'TGPUSkinMorphVertexFactoryDefault' Type 'TShadowDepthVSVertexShadowDepth_OnePassPointLight' '/Engine/Private/ShadowDepthVertexShader.usf' Entry 'Main' Permutation 0
PackagingResults: Error: SCW 10 Queued Jobs, Finished 9 single jobs
PackagingResults: Error: Job 0 [Single] WorldGridMaterial/FTranslucentLightingInjectPS/8:/Engine/Private/TranslucentLightInjectionShaders.usf Type 'FTranslucentLightingInjectPS' '/Engine/Private/TranslucentLightInjectionShaders.usf' Entry 'InjectMainPS' Permutation 8
PackagingResults: Error: Job 1 [Single] WorldGridMaterial/FTranslucentLightingInjectPS/7:/Engine/Private/TranslucentLightInjectionShaders.usf Type 'FTranslucentLightingInjectPS' '/Engine/Private/TranslucentLightInjectionShaders.usf' Entry 'InjectMainPS' Permutation 7
PackagingResults: Error: Job 2 [Single] WorldGridMaterial/FTranslucentLightingInjectPS/5:/Engine/Private/TranslucentLightInjectionShaders.usf Type 'FTranslucentLightingInjectPS' '/Engine/Private/TranslucentLightInjectionShaders.usf' Entry 'InjectMainPS' Permutation 5
PackagingResults: Error: Job 3 [Single] WorldGridMaterial/FTranslucentLightingInjectPS/3:/Engine/Private/TranslucentLightInjectionShaders.usf Type 'FTranslucentLightingInjectPS' '/Engine/Private/TranslucentLightInjectionShaders.usf' Entry 'InjectMainPS' Permutation 3
PackagingResults: Error: Job 4 [Single] WorldGridMaterial/FTranslucentLightingInjectPS/1:/Engine/Private/TranslucentLightInjectionShaders.usf Type 'FTranslucentLightingInjectPS' '/Engine/Private/TranslucentLightInjectionShaders.usf' Entry 'InjectMainPS' Permutation 1
PackagingResults: Error: Job 5: Pipeline DepthNoPixelPipeline
PackagingResults: Error: PipelineJob 0 WorldGridMaterial/DepthNoPixelPipeline/TGPUSkinMorphVertexFactoryDefault/TDepthOnlyVS<false>/0:/Engine/Private/DepthOnlyVertexShader.usf VF 'TGPUSkinMorphVertexFactoryDefault' Type 'TDepthOnlyVS<false>' '/Engine/Private/DepthOnlyVertexShader.usf' Entry 'Main' Permutation 0
PackagingResults: Error: Job 6: Pipeline VelocityPipeline
PackagingResults: Error: PipelineJob 0 WorldGridMaterial/VelocityPipeline/TGPUSkinMorphVertexFactoryDefault/FVelocityPS/0:/Engine/Private/VelocityShader.usf VF 'TGPUSkinMorphVertexFactoryDefault' Type 'FVelocityPS' '/Engine/Private/VelocityShader.usf' Entry 'MainPixelShader' Permutation 0
PackagingResults: Error: PipelineJob 1 WorldGridMaterial/VelocityPipeline/TGPUSkinMorphVertexFactoryDefault/FVelocityVS/0:/Engine/Private/VelocityShader.usf VF 'TGPUSkinMorphVertexFactoryDefault' Type 'FVelocityVS' '/Engine/Private/VelocityShader.usf' Entry 'MainVertexShader' Permutation 0
PackagingResults: Error: Job 7 [Single] WorldGridMaterial/TGPUSkinMorphVertexFactoryDefault/FOnePassPointShadowDepthGS/0:/Engine/Private/ShadowDepthVertexShader.usf VF 'TGPUSkinMorphVertexFactoryDefault' Type 'FOnePassPointShadowDepthGS' '/Engine/Private/ShadowDepthVertexShader.usf' Entry 'MainOnePassPointLightGS' Permutation 0
PackagingResults: Error: Job 8 [Single] WorldGridMaterial/TGPUSkinMorphVertexFactoryDefault/TBasePassVSFNoLightMapPolicy/0:/Engine/Private/BasePassVertexShader.usf VF 'TGPUSkinMorphVertexFactoryDefault' Type 'TBasePassVSFNoLightMapPolicy' '/Engine/Private/BasePassVertexShader.usf' Entry 'Main' Permutation 0
PackagingResults: Error: Job 9 [Single] WorldGridMaterial/TGPUSkinMorphVertexFactoryDefault/TShadowDepthVSVertexShadowDepth_OnePassPointLight/0:/Engine/Private/ShadowDepthVertexShader.usf VF 'TGPUSkinMorphVertexFactoryDefault' Type 'TShadowDepthVSVertexShadowDepth_OnePassPointLight' '/Engine/Private/ShadowDepthVertexShader.usf' Entry 'Main' Permutation 0
UATHelper: Cooking (Windows):   LogCook: Display: Cook Diagnostics: OpenFileHandles=751, VirtualMemory=1480MiB
UATHelper: Cooking (Windows):   LogThreadingWindows: Error: Runnable thread ShaderCompilingThread crashed.
UATHelper: Cooking (Windows):   LogWindows: Error: begin: stack for UAT
UATHelper: Cooking (Windows):   LogWindows: Error: === Critical error: ===
UATHelper: Cooking (Windows):   LogWindows: Error:
UATHelper: Cooking (Windows):   LogWindows: Error: Fatal error: [File:D:/build/++UE5/Sync/Engine/Source/Runtime/Engine/Private/ShaderCompiler/ShaderCompiler.cpp] [Line: 970]
UATHelper: Cooking (Windows):   LogWindows: Error: ShaderCompileWorker crashed!
UATHelper: Cooking (Windows):   LogWindows: Error:
UATHelper: Cooking (Windows):   LogWindows: Error:     Assertion failed: IsValidIndex(Index) [File:D:\build\++UE5\Sync\Engine\Source\Runtime\Core\Public\Containers/UnrealString.h] [Line: 347]
UATHelper: Cooking (Windows):   LogWindows: Error: String index out of bounds: Index 0 from a string with a length of 0
UATHelper: Cooking (Windows):   LogWindows: Error: [Callstack] 0x00007ffc6af594db ShaderCompileWorker-ShaderCompilerCommon.dll!RemoveUniformBuffersFromSource() []
UATHelper: Cooking (Windows):   LogWindows: Error: [Callstack] 0x00007ffc8f20003c ShaderCompileWorker-ShaderFormatD3D.dll!CompileD3DShader() []
UATHelper: Cooking (Windows):   LogWindows: Error: [Callstack] 0x00007ffc8f2011be ShaderCompileWorker-ShaderFormatD3D.dll!CompileShader_Windows() []
UATHelper: Cooking (Windows):   LogWindows: Error: [Callstack] 0x00007ffc8f200ce5 ShaderCompileWorker-ShaderFormatD3D.dll!FShaderFormatD3D::CompileShader() []
UATHelper: Cooking (Windows):   LogWindows: Error: [Callstack] 0x00007ff662caa1f0 ShaderCompileWorker.exe!ProcessCompilationJob() []
UATHelper: Cooking (Windows):   LogWindows: Error: [Callstack] 0x00007ff662cabda3 ShaderCompileWorker.exe!FWorkLoop::ProcessShaderPipelineCompilationJob() []
UATHelper: Cooking (Windows):   LogWindows: Error: [Callstack] 0x00007ff662cabb3c ShaderCompileWorker.exe!FWorkLoop::ProcessInputFromArchive() []
UATHelper: Cooking (Windows):   LogWindows: Error: [Callstack] 0x00007ff662ca6725 ShaderCompileWorker.exe!FWorkLoop::Loop() []
UATHelper: Cooking (Windows):   LogWindows: Error: [Callstack] 0x00007ff662ca42f0 ShaderCompileWorker.exe!GuardedMain() []
UATHelper: Cooking (Windows):   LogWindows: Error: [Callstack] 0x00007ff662ca454d ShaderCompileWorker.exe!GuardedMainWrapper() []
UATHelper: Cooking (Windows):   LogWindows: Error: [Callstack] 0x00007ff662cb27b8 ShaderCompileWorker.exe!wmain() []
UATHelper: Cooking (Windows):   LogWindows: Error: [Callstack] 0x00007ff662cb3ae8 ShaderCompileWorker.exe!__scrt_common_main_seh() []
UATHelper: Cooking (Windows):   LogWindows: Error: [Callstack] 0x00007ffd50e67034 KERNEL32.DLL!UnknownFunction []
UATHelper: Cooking (Windows):   LogWindows: Error: [Callstack] 0x00007ffd51e02651 ntdll.dll!UnknownFunction []
UATHelper: Cooking (Windows):   LogWindows: Error:
UATHelper: Cooking (Windows):   LogWindows: Error:
UATHelper: Cooking (Windows):   LogWindows: Error:
UATHelper: Cooking (Windows):   LogWindows: Error:
UATHelper: Cooking (Windows):   LogWindows: Error:
UATHelper: Cooking (Windows):   LogWindows: Error:
UATHelper: Cooking (Windows):   LogWindows: Error: [Callstack] 0x00007ffc746d84a4 UnrealEditor-Engine.dll!UnknownFunction []
UATHelper: Cooking (Windows):   LogWindows: Error: [Callstack] 0x00007ffc746da6ec UnrealEditor-Engine.dll!UnknownFunction []
UATHelper: Cooking (Windows):   LogWindows: Error: [Callstack] 0x00007ffc746c23d0 UnrealEditor-Engine.dll!UnknownFunction []
UATHelper: Cooking (Windows):   LogWindows: Error: [Callstack] 0x00007ffc746f0675 UnrealEditor-Engine.dll!UnknownFunction []
UATHelper: Cooking (Windows):   LogWindows: Error: [Callstack] 0x00007ffc746bc869 UnrealEditor-Engine.dll!UnknownFunction []
UATHelper: Cooking (Windows):   LogWindows: Error: [Callstack] 0x00007ffc746fb496 UnrealEditor-Engine.dll!UnknownFunction []
UATHelper: Cooking (Windows):   LogWindows: Error: [Callstack] 0x00007ffccbe3394b UnrealEditor-Core.dll!UnknownFunction []
UATHelper: Cooking (Windows):   LogWindows: Error: [Callstack] 0x00007ffccbe2c640 UnrealEditor-Core.dll!UnknownFunction []
UATHelper: Cooking (Windows):   LogWindows: Error: [Callstack] 0x00007ffd50e67034 KERNEL32.DLL!UnknownFunction []
UATHelper: Cooking (Windows):   LogWindows: Error: [Callstack] 0x00007ffd51e02651 ntdll.dll!UnknownFunction []
UATHelper: Cooking (Windows):   LogWindows: Error:
UATHelper: Cooking (Windows):   LogWindows: Error: Crash in runnable thread ShaderCompilingThread
UATHelper: Cooking (Windows):   LogWindows: Error: end: stack for UAT
PackagingResults: Error: Runnable thread ShaderCompilingThread crashed.
PackagingResults: Error: begin: stack for UAT
PackagingResults: Error: === Critical error: ===
PackagingResults: Error: Fatal error: [File:D:/build/++UE5/Sync/Engine/Source/Runtime/Engine/Private/ShaderCompiler/ShaderCompiler.cpp] [Line: 970]
PackagingResults: Error: ShaderCompileWorker crashed!
PackagingResults: Error:     Assertion failed: IsValidIndex(Index) [File:D:\build\++UE5\Sync\Engine\Source\Runtime\Core\Public\Containers/UnrealString.h] [Line: 347]
PackagingResults: Error: String index out of bounds: Index 0 from a string with a length of 0
PackagingResults: Error: [Callstack] 0x00007ffc6af594db ShaderCompileWorker-ShaderCompilerCommon.dll!RemoveUniformBuffersFromSource() []
PackagingResults: Error: [Callstack] 0x00007ffc8f20003c ShaderCompileWorker-ShaderFormatD3D.dll!CompileD3DShader() []
PackagingResults: Error: [Callstack] 0x00007ffc8f2011be ShaderCompileWorker-ShaderFormatD3D.dll!CompileShader_Windows() []
PackagingResults: Error: [Callstack] 0x00007ffc8f200ce5 ShaderCompileWorker-ShaderFormatD3D.dll!FShaderFormatD3D::CompileShader() []
PackagingResults: Error: [Callstack] 0x00007ff662caa1f0 ShaderCompileWorker.exe!ProcessCompilationJob() []
PackagingResults: Error: [Callstack] 0x00007ff662cabda3 ShaderCompileWorker.exe!FWorkLoop::ProcessShaderPipelineCompilationJob() []
PackagingResults: Error: [Callstack] 0x00007ff662cabb3c ShaderCompileWorker.exe!FWorkLoop::ProcessInputFromArchive() []
PackagingResults: Error: [Callstack] 0x00007ff662ca6725 ShaderCompileWorker.exe!FWorkLoop::Loop() []
PackagingResults: Error: [Callstack] 0x00007ff662ca42f0 ShaderCompileWorker.exe!GuardedMain() []
PackagingResults: Error: [Callstack] 0x00007ff662ca454d ShaderCompileWorker.exe!GuardedMainWrapper() []
PackagingResults: Error: [Callstack] 0x00007ff662cb27b8 ShaderCompileWorker.exe!wmain() []
PackagingResults: Error: [Callstack] 0x00007ff662cb3ae8 ShaderCompileWorker.exe!__scrt_common_main_seh() []
PackagingResults: Error: [Callstack] 0x00007ffd50e67034 KERNEL32.DLL!UnknownFunction []
PackagingResults: Error: [Callstack] 0x00007ffd51e02651 ntdll.dll!UnknownFunction []
PackagingResults: Error: [Callstack] 0x00007ffc746d84a4 UnrealEditor-Engine.dll!UnknownFunction []
PackagingResults: Error: [Callstack] 0x00007ffc746da6ec UnrealEditor-Engine.dll!UnknownFunction []
PackagingResults: Error: [Callstack] 0x00007ffc746c23d0 UnrealEditor-Engine.dll!UnknownFunction []
PackagingResults: Error: [Callstack] 0x00007ffc746f0675 UnrealEditor-Engine.dll!UnknownFunction []
PackagingResults: Error: [Callstack] 0x00007ffc746bc869 UnrealEditor-Engine.dll!UnknownFunction []
PackagingResults: Error: [Callstack] 0x00007ffc746fb496 UnrealEditor-Engine.dll!UnknownFunction []
PackagingResults: Error: [Callstack] 0x00007ffccbe3394b UnrealEditor-Core.dll!UnknownFunction []
PackagingResults: Error: [Callstack] 0x00007ffccbe2c640 UnrealEditor-Core.dll!UnknownFunction []
PackagingResults: Error: [Callstack] 0x00007ffd50e67034 KERNEL32.DLL!UnknownFunction []
PackagingResults: Error: [Callstack] 0x00007ffd51e02651 ntdll.dll!UnknownFunction []
PackagingResults: Error: Crash in runnable thread ShaderCompilingThread
PackagingResults: Error: end: stack for UAT
UATHelper: Cooking (Windows): Took 46.000947599999996s to run UnrealEditor-Cmd.exe, ExitCode=3
UATHelper: Cooking (Windows): ERROR: Cook failed.
UATHelper: Cooking (Windows):        (see C:\Users\User\AppData\Roaming\Unreal Engine\AutomationTool\Logs\C+UE_5.0EA\Log.txt for full exception trace)
UATHelper: Cooking (Windows): AutomationTool exiting with ExitCode=25 (Error_UnknownCookFailure)
PackagingResults: Error: Cook failed.
UATHelper: Cooking (Windows): BUILD FAILED

Any pointers as to why this happens? Thanks in advance for any info.

I am unfortunately using UE5 EA2, by when I saw potential in this project I was already deep in development and I couldn’t find a way to downgrade my project without rewriting it…