UE5.1 Packaging Error: System.ArgumentOutOfRangeException: startIndex cannot be larger than length of string. (Parameter 'startIndex')

Hi everyone, I need some help here.
After I finish making my game in UE5.1, I try to package project to windows platform.
But I got an error.

“System.ArgumentOutOfRangeException: startIndex cannot be larger than length of string. (Parameter ‘startIndex’)”

Can this be fixed?
How do I fix this?
Did anyone else have the same issue with me?

This is the log that I received.

ERROR: System.ArgumentOutOfRangeException: startIndex cannot be larger than length of string. (Parameter 'startIndex')
          at System.String.Substring(Int32 startIndex, Int32 length)
          at AutomationScripts.Project.OrderFile..ctor(FileReference FileRef, OrderFileType InType, Int32 SpecIndex, Int32 InPriority) in D:\build\++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\AutomationTool\Scripts\CopyBuildToStagingDirectory.Automation.cs:line 60
          at AutomationScripts.Project.CreatePaks(ProjectParams Params, DeploymentContext SC, List`1 PakParamsList, CryptoSettings CryptoSettings, FileReference CryptoKeysCacheFilename) in D:\build\++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\AutomationTool\Scripts\CopyBuildToStagingDirectory.Automation.cs:line 2889
          at AutomationScripts.Project.CreatePakUsingStagingManifest(ProjectParams Params, DeploymentContext SC) in D:\build\++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\AutomationTool\Scripts\CopyBuildToStagingDirectory.Automation.cs:line 2331
          at AutomationScripts.Project.ApplyStagingManifest(ProjectParams Params, DeploymentContext SC) in D:\build\++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\AutomationTool\Scripts\CopyBuildToStagingDirectory.Automation.cs:line 4206
          at AutomationScripts.Project.CopyBuildToStagingDirectory(ProjectParams Params) in D:\build\++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\AutomationTool\Scripts\CopyBuildToStagingDirectory.Automation.cs:line 4641
          at BuildCookRun.DoBuildCookRun(ProjectParams Params) in D:\build\++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\AutomationTool\Scripts\BuildCookRun.Automation.cs:line 222
          at BuildCookRun.ExecuteBuild() in D:\build\++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\AutomationTool\Scripts\BuildCookRun.Automation.cs:line 42
          at AutomationTool.BuildCommand.Execute() in D:\build\++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\AutomationTool\AutomationUtils\BuildCommand.cs:line 344
          at AutomationTool.BuildCommand.ExecuteAsync() in D:\build\++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\AutomationTool\AutomationUtils\BuildCommand.cs:line 353
          at AutomationTool.Automation.ExecuteAsync(List`1 CommandsToExecute, Dictionary`2 Commands) in D:\build\++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\AutomationTool\AutomationUtils\Automation.cs:line 257
          at AutomationTool.Automation.ProcessAsync(ParsedCommandLine AutomationToolCommandLine, StartupTraceListener StartupListener, HashSet`1 ScriptModuleAssemblies) in D:\build\++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\AutomationTool\AutomationUtils\Automation.cs:line 156

Log.txt (98.0 KB)

And this is other information that I know with my case.

  • The game can be launch normally without any issue, But I still can’t packaging project.
  • I download UE5.1 from Epic Games Launcher.
  • I create new project from the sample and packaging it to see if that issue was only effect to my project. And the result is the sample get the same error too.
  • I also try this with other computer which is never install Unreal Engine before. And it also get the same error too.
  • Android platform also get the same type of error with ‘startIndex’ parameter too.
  • This issue does not effect to UE5.0.3, That version can packaging successfully.

My only guess is there are something wrong in engine file. Is this correct?
But I never go mess with an engine file.
And I don’t have much knowledge about C++. My game is made in blueprint.
So I have no idea how to fix this. Can anyone help me please.

Thanks for reading until the end.
I would be so glad if this can be fixed ;w;

I faced the same issue. My workaround is to disable “Use Pak File” and “Use Io Store” in Project Settings. (You may only need to disable one of these.) After that my project built just fine.

But still, i don’t know what really causing the issue.

1 Like

I tried your method but still…

==============================================================================
ERROR: System.ArgumentOutOfRangeException: startIndex cannot be larger than length of string. (Parameter 'startIndex')
          at System.String.Substring(Int32 startIndex, Int32 length)
          at AutomationScripts.Project.OrderFile..ctor(FileReference FileRef, OrderFileType InType, Int32 SpecIndex, Int32 InPriority) in C:\Program Files\Epic Games\UE_5.1\Engine\Source\Programs\AutomationTool\Scripts\CopyBuildToStagingDirectory.Automation.cs:line 60
          at AutomationScripts.Project.CreatePaks(ProjectParams Params, DeploymentContext SC, List`1 PakParamsList, CryptoSettings CryptoSettings, FileReference CryptoKeysCacheFilename) in C:\Program Files\Epic Games\UE_5.1\Engine\Source\Programs\AutomationTool\Scripts\CopyBuildToStagingDirectory.Automation.cs:line 2889
          at AutomationScripts.Project.CreatePakUsingStagingManifest(ProjectParams Params, DeploymentContext SC) in C:\Program Files\Epic Games\UE_5.1\Engine\Source\Programs\AutomationTool\Scripts\CopyBuildToStagingDirectory.Automation.cs:line 2331
          at AutomationScripts.Project.ApplyStagingManifest(ProjectParams Params, DeploymentContext SC) in C:\Program Files\Epic Games\UE_5.1\Engine\Source\Programs\AutomationTool\Scripts\CopyBuildToStagingDirectory.Automation.cs:line 4206
          at AutomationScripts.Project.CopyBuildToStagingDirectory(ProjectParams Params) in C:\Program Files\Epic Games\UE_5.1\Engine\Source\Programs\AutomationTool\Scripts\CopyBuildToStagingDirectory.Automation.cs:line 4641
          at BuildCookRun.DoBuildCookRun(ProjectParams Params) in C:\Program Files\Epic Games\UE_5.1\Engine\Source\Programs\AutomationTool\Scripts\BuildCookRun.Automation.cs:line 222
          at BuildCookRun.ExecuteBuild() in C:\Program Files\Epic Games\UE_5.1\Engine\Source\Programs\AutomationTool\Scripts\BuildCookRun.Automation.cs:line 42
          at AutomationTool.BuildCommand.Execute() in C:\Program Files\Epic Games\UE_5.1\Engine\Source\Programs\AutomationTool\AutomationUtils\BuildCommand.cs:line 344
          at AutomationTool.BuildCommand.ExecuteAsync() in C:\Program Files\Epic Games\UE_5.1\Engine\Source\Programs\AutomationTool\AutomationUtils\BuildCommand.cs:line 353
          at AutomationTool.Automation.ExecuteAsync(List`1 CommandsToExecute, Dictionary`2 Commands) in C:\Program Files\Epic Games\UE_5.1\Engine\Source\Programs\AutomationTool\AutomationUtils\Automation.cs:line 257
          at AutomationTool.Automation.ProcessAsync(ParsedCommandLine AutomationToolCommandLine, StartupTraceListener StartupListener, HashSet`1 ScriptModuleAssemblies) in C:\Program Files\Epic Games\UE_5.1\Engine\Source\Programs\AutomationTool\AutomationUtils\Automation.cs:line 156
       (see C:\Users\Aum_l\AppData\Roaming\Unreal Engine\AutomationTool\Logs\C+Program+Files+Epic+Games+UE_5.1\Log.txt for full exception trace)

ArgumentOutOfRangeException: startIndex cannot be larger than length of string. (Parameter 'startIndex')
   at System.String.Substring(Int32 startIndex, Int32 length)
   at AutomationScripts.Project.OrderFile..ctor(FileReference FileRef, OrderFileType InType, Int32 SpecIndex, Int32 InPriority) in C:\Program Files\Epic Games\UE_5.1\Engine\Source\Programs\AutomationTool\Scripts\CopyBuildToStagingDirectory.Automation.cs:line 60
   at AutomationScripts.Project.CreatePaks(ProjectParams Params, DeploymentContext SC, List`1 PakParamsList, CryptoSettings CryptoSettings, FileReference CryptoKeysCacheFilename) in C:\Program Files\Epic Games\UE_5.1\Engine\Source\Programs\AutomationTool\Scripts\CopyBuildToStagingDirectory.Automation.cs:line 2889
   at AutomationScripts.Project.CreatePakUsingStagingManifest(ProjectParams Params, DeploymentContext SC) in C:\Program Files\Epic Games\UE_5.1\Engine\Source\Programs\AutomationTool\Scripts\CopyBuildToStagingDirectory.Automation.cs:line 2331
   at AutomationScripts.Project.ApplyStagingManifest(ProjectParams Params, DeploymentContext SC) in C:\Program Files\Epic Games\UE_5.1\Engine\Source\Programs\AutomationTool\Scripts\CopyBuildToStagingDirectory.Automation.cs:line 4206
   at AutomationScripts.Project.CopyBuildToStagingDirectory(ProjectParams Params) in C:\Program Files\Epic Games\UE_5.1\Engine\Source\Programs\AutomationTool\Scripts\CopyBuildToStagingDirectory.Automation.cs:line 4641
   at BuildCookRun.DoBuildCookRun(ProjectParams Params) in C:\Program Files\Epic Games\UE_5.1\Engine\Source\Programs\AutomationTool\Scripts\BuildCookRun.Automation.cs:line 222
   at BuildCookRun.ExecuteBuild() in C:\Program Files\Epic Games\UE_5.1\Engine\Source\Programs\AutomationTool\Scripts\BuildCookRun.Automation.cs:line 42
   at AutomationTool.BuildCommand.Execute() in C:\Program Files\Epic Games\UE_5.1\Engine\Source\Programs\AutomationTool\AutomationUtils\BuildCommand.cs:line 344
   at AutomationTool.BuildCommand.ExecuteAsync() in C:\Program Files\Epic Games\UE_5.1\Engine\Source\Programs\AutomationTool\AutomationUtils\BuildCommand.cs:line 353
   at AutomationTool.Automation.ExecuteAsync(List`1 CommandsToExecute, Dictionary`2 Commands) in C:\Program Files\Epic Games\UE_5.1\Engine\Source\Programs\AutomationTool\AutomationUtils\Automation.cs:line 257
   at AutomationTool.Automation.ProcessAsync(ParsedCommandLine AutomationToolCommandLine, StartupTraceListener StartupListener, HashSet`1 ScriptModuleAssemblies) in C:\Program Files\Epic Games\UE_5.1\Engine\Source\Programs\AutomationTool\AutomationUtils\Automation.cs:line 156
==============================================================================
AutomationTool executed for 0h 0m 20s
AutomationTool exiting with ExitCode=1 (Error_Unknown)

Log.txt (106.6 KB)

Helpppppppppppppp !!!