CopyFile function in CommandUtils.cs assumes that an exception will be thrown if the number of retries is exceeded, but the loop condition prevents it from being thrown.

Following fix works:

        public static void CopyFile(string Source, string Dest, bool bQuiet = false, bool bRetry = false)
//			for (int AttemptsRemaining = 5; AttemptsRemaining > 0; --AttemptsRemaining)
			for (int AttemptsRemaining = 5; AttemptsRemaining >= 0; --AttemptsRemaining) // workaround
				if (InternalUtils.SafeFileExists(Dest, true))
					InternalUtils.SafeDeleteFile(Dest, bQuiet);
				if (InternalUtils.SafeFileExists(Dest, true))
					if (bRetry && AttemptsRemaining > 0)

Steps to Reproduce
  1. Prepare a disk drive with low remaining disk space
  2. Run a BuildGraph (example : [Link Removed]) to copy some files to the drive
    Example command line is :
    D:\dev\UnrealEngine-5.1.1\Engine\Build\BatchFiles\RunUAT.bat BuildGraph -target="Manipulate Some Files" -script="Engine\Build\Graph\Examples\Copy.xml"



UAT outputs the following error message about 50 times, but the script continues.

SafeCopyFile Exception was Exception in System.Private.CoreLib: There is not enough space on the disk : 'R:\Engine\TestNumber3\EpicGamesLauncherInstaller.msi'
Stacktrace:    at System.IO.FileSystem.CopyFile(String sourceFullPath, String destFullPath, Boolean overwrite)
   at System.IO.File.Copy(String sourceFileName, String destFileName, Boolean overwrite)
   at AutomationTool.InternalUtils.SafeCopyFile(String SourceName, String TargetName, Boolean bQuiet, List`1 IniKeyDenyList, List`1 IniSectionDenyList) in D:\dev\UnrealEngine-5.1.1\Engine\Source\Programs\AutomationTool\AutomationUtils\Utils.cs:line 446

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-178656 in the post.

Login to Vote

ComponentUE - Foundation - Horde - BuildGraph
Affects Versions5.1
Target Fix5.3
Fix Commit24461900
Main Commit24461900
CreatedFeb 28, 2023
ResolvedMar 1, 2023
UpdatedApr 29, 2023