System.IO.FileFormatException: Compressed part has inconsistent data length

Hi,
sometimes it appens, when I try to deploy a package that was pushed on octopus built-in nuget gallery by Octopack, that process exits with this error:
System.IO.FileFormatException: Compressed part has inconsistent data length.
16:30:26Error
at MS.Internal.IO.Packaging.CompressStream.UpdateUncompressedDataLength(Int64 dataLength)
16:30:26Error
at MS.Internal.IO.Packaging.CompressStream.Read(Byte[] buffer, Int32 offset, Int32 count)
16:30:26Error
at MS.Internal.IO.Zip.ProgressiveCrcCalculatingStream.Read(Byte[] buffer, Int32 offset, Int32 count)
16:30:26Error
at MS.Internal.IO.Zip.ZipIOModeEnforcingStream.Read(Byte[] buffer, Int32 offset, Int32 count)
16:30:26Error
at System.IO.Stream.InternalCopyTo(Stream destination, Int32 bufferSize)
16:30:26Error
at Calamari.Integration.Packages.LightweightPackageExtractor.Install(String packageFile, String directory, Boolean suppressNestedScriptWarning, Int32& filesExtracted) in Y:\work\14ffc968155e4956\source\Calamari\Integration\Packages\LightweightPackageExtractor.cs:line 87
16:30:26Error
at Calamari.Deployment.Conventions.ExtractPackageConvention.Install(RunningDeployment deployment) in Y:\work\14ffc968155e4956\source\Calamari\Deployment\Conventions\ExtractPackageConvention.cs:line 28
16:30:26Error
at Calamari.Deployment.ConventionProcessor.RunInstallConventions() in Y:\work\14ffc968155e4956\source\Calamari\Deployment\ConventionProcessor.cs:line 60
16:30:26Error
at Calamari.Deployment.ConventionProcessor.RunConventions() in Y:\work\14ffc968155e4956\source\Calamari\Deployment\ConventionProcessor.cs:line 28
16:30:26Error
Running rollback conventions…
16:30:27Error
System.ArgumentNullException: Value cannot be null.
16:30:27Error
Parameter name: path
16:30:27Error
at System.IO.DirectoryInfo…ctor(String path)
16:30:27Error
at Calamari.Integration.FileSystem.CalamariPhysicalFileSystem.EnumerateFiles(String parentDirectoryPath, String[] searchPatterns) in Y:\work\14ffc968155e4956\source\Calamari\Integration\FileSystem\CalamariPhysicalFileSystem.cs:line 181
16:30:27Error
at Calamari.Integration.Scripting.PackagedScriptRunner.FindScripts(RunningDeployment deployment) in Y:\work\14ffc968155e4956\source\Calamari\Integration\Scripting\PackagedScriptRunner.cs:line 55
16:30:27Error
at Calamari.Integration.Scripting.PackagedScriptRunner.RunScripts(RunningDeployment deployment) in Y:\work\14ffc968155e4956\source\Calamari\Integration\Scripting\PackagedScriptRunner.cs:line 31
16:30:27Error
at Calamari.Deployment.ConventionProcessor.RunRollbackConventions() in Y:\work\14ffc968155e4956\source\Calamari\Deployment\ConventionProcessor.cs:line 71
16:30:27Error
at Calamari.Deployment.ConventionProcessor.RunConventions() in Y:\work\14ffc968155e4956\source\Calamari\Deployment\ConventionProcessor.cs:line 48
16:30:27Error
at Calamari.Commands.DeployPackageCommand.Execute(String[] commandLineArguments) in Y:\work\14ffc968155e4956\source\Calamari\Commands\DeployPackageCommand.cs:line 113
16:30:27Error
at Calamari.Program.Execute(String[] args) in Y:\work\14ffc968155e4956\source\Calamari\Program.cs:line 38
16:30:28Fatal
The remote script failed with exit code 100

I think that the problem is the package corrupted after upload by Octopack.

Situation:

  1. Octopack ver. 3.0.53
  2. Octopus 3.2.24
  3. No firewall in server and tentacle machines.

Could you help me please?

Hi Carlo,

Yes, looking at your stack-trace, it would seem your NuGet package is corrupt.

We’ve not seen this error before. The stages where something could be malfunctioning include:

  • Package creation
  • Package upload to the Octopus Deploy Built-In Repository
  • Package push from the Octopus Server to the Tentacle

It might be helpful to experiment a little to determine at which stage the problem is occurring. The next time the problem occurs, could you possibly try:

  • Download the effected NuGet package from Octopus (Library -> Packages -> [Specific Package] -> [Specific Version] -> Download), and install it locally using the NuGet command line.
  • Manually upload the package created by OctoPack into Octopus Deploy (Library -> Packages -> Upload Package)

I would be interested to hear the results after each of those steps. That should help us determine where the problem lies.

Regards,
Michael

Hi Michael,
the problem occurs randomly, about 1 time a day (in a day we are publishing about 30/40 package).
Here you are the result of my try:

  1. If I try to download package from Library page and try to install locally with NuGet command line or open it with NuGet package explorer, error “Compressed part has inconsistent data length” appears
  2. If I manually upload the package created by OctoPack into Octopus Deploy, the error disappears

So it seems that it is a comunication problem…

Carlo

Thanks Carlo,

Yes, that certainly seems to indicate the problem is occurring during the upload to the Octopus Server.

Is it possible that duplicate packages are being uploaded simultaneously? For example, multiple TeamCity build-agents running and pushing the same version of a package at the same time?

Thanks Michael,
no, we are using only one TFS 2015 build agent vnext at a time…

Are your TFS Build Agent and Octopus server co-located, or located remotely? e.g. is your Build Agent in Azure, and your Octopus server local, or vice-versa?

The only advice I can think to provide is to try locating them as closely as possible.

It would seem the package being built by OctoPack is fine. OctoPack then simply invokes NuGet to perform the push to the repository (in this case the Octopus built-in repository). It seems your packages are occasionally not surviving the voyage intact.

I wish I had a more concrete solution for you. Please let us know if we can provide any further help.

Regards,
Michael