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

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.
at MS.Internal.IO.Packaging.CompressStream.UpdateUncompressedDataLength(Int64 dataLength)
at MS.Internal.IO.Packaging.CompressStream.Read(Byte[] buffer, Int32 offset, Int32 count)
at MS.Internal.IO.Zip.ProgressiveCrcCalculatingStream.Read(Byte[] buffer, Int32 offset, Int32 count)
at MS.Internal.IO.Zip.ZipIOModeEnforcingStream.Read(Byte[] buffer, Int32 offset, Int32 count)
at System.IO.Stream.InternalCopyTo(Stream destination, Int32 bufferSize)
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
at Calamari.Deployment.Conventions.ExtractPackageConvention.Install(RunningDeployment deployment) in Y:\work\14ffc968155e4956\source\Calamari\Deployment\Conventions\ExtractPackageConvention.cs:line 28
at Calamari.Deployment.ConventionProcessor.RunInstallConventions() in Y:\work\14ffc968155e4956\source\Calamari\Deployment\ConventionProcessor.cs:line 60
at Calamari.Deployment.ConventionProcessor.RunConventions() in Y:\work\14ffc968155e4956\source\Calamari\Deployment\ConventionProcessor.cs:line 28
Running rollback conventions…
System.ArgumentNullException: Value cannot be null.
Parameter name: path
at System.IO.DirectoryInfo…ctor(String path)
at Calamari.Integration.FileSystem.CalamariPhysicalFileSystem.EnumerateFiles(String parentDirectoryPath, String[] searchPatterns) in Y:\work\14ffc968155e4956\source\Calamari\Integration\FileSystem\CalamariPhysicalFileSystem.cs:line 181
at Calamari.Integration.Scripting.PackagedScriptRunner.FindScripts(RunningDeployment deployment) in Y:\work\14ffc968155e4956\source\Calamari\Integration\Scripting\PackagedScriptRunner.cs:line 55
at Calamari.Integration.Scripting.PackagedScriptRunner.RunScripts(RunningDeployment deployment) in Y:\work\14ffc968155e4956\source\Calamari\Integration\Scripting\PackagedScriptRunner.cs:line 31
at Calamari.Deployment.ConventionProcessor.RunRollbackConventions() in Y:\work\14ffc968155e4956\source\Calamari\Deployment\ConventionProcessor.cs:line 71
at Calamari.Deployment.ConventionProcessor.RunConventions() in Y:\work\14ffc968155e4956\source\Calamari\Deployment\ConventionProcessor.cs:line 48
at Calamari.Commands.DeployPackageCommand.Execute(String[] commandLineArguments) in Y:\work\14ffc968155e4956\source\Calamari\Commands\DeployPackageCommand.cs:line 113
at Calamari.Program.Execute(String[] args) in Y:\work\14ffc968155e4956\source\Calamari\Program.cs:line 38
The remote script failed with exit code 100

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


  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.


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…


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.