When deploying a custom solution to a Sitecore XP instance, installing a package might fail if the package size exceeds 2047 megabytes. An error similar to the following can be found in the logs:
Exception: System.ArgumentOutOfRangeException
Message: Specified argument was out of the range of valid values.
Parameter name: count
Source: System
at System.IO.Compression.DeflateStream.ValidateParameters(Byte[] array, Int32 offset, Int32 count)
at System.IO.Compression.DeflateStream.Read(Byte[] array, Int32 offset, Int32 count)
at Sitecore.Zip.Utils.LimitedReadOnlyStream.Read(Byte[] buffer, Int32 offset, Int32 count)
at Sitecore.Install.StreamUtil.Copy(Stream from, Stream to, Int32 bufferSize)
at Sitecore.Install.Zip.PackageReader.Populate(ISink`1 sink)
at Sitecore.Shell.Applications.Install.Dialogs.InstallPackage.InstallPackageForm.LoadPackage()
at Sitecore.Shell.Applications.Install.Dialogs.InstallPackage.InstallPackageForm.ActivePageChanging(String page, String& newpage)
at Sitecore.Web.UI.Pages.WizardForm.set_Active(String value)
Exception: System.IO.IOException
Message: An attempt was made to move the file pointer before the beginning of the file.
Source: mscorlib
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.SeekCore(Int64 offset, SeekOrigin origin)
at System.IO.FileStream.Seek(Int64 offset, SeekOrigin origin)
at Sitecore.Zip.ZipReader.d__0.MoveNext()
at Sitecore.Zip.ZipReader.GetEntry(String entryName)
at Sitecore.Install.Zip.PackageReader.Populate(ISink`1 sink)
at Sitecore.Shell.Applications.Install.Dialogs.InstallPackage.InstallPackageForm.LoadPackage()
at Sitecore.Shell.Applications.Install.Dialogs.InstallPackage.InstallPackageForm.ActivePageChanging(String page, String& newpage)
at Sitecore.Web.UI.Pages.WizardForm.set_Active(String value)
at Sitecore.Web.UI.HtmlControls.Button.DoClick(Message message)