Sequence contains no matching element after package removal

An 1.0.6 release is created of a project that comprises nearly 20 different packages. This release is pushed to our Test environment. After some testing, it is decided that a package needs to be removed before pushing the release to our Pre-Prod environment. This package has sequence number 2.

The package is removed, and the same release is pushed to preprod. It fails after downloading the first package, with the following error:

Downloading package (attempt 1 of 5)
2011-12-12 08:15:25 DEBUG Package KH.HAPI.Web.CommerceServerTranslationService is a web package. Downloading from
2011-12-12 08:15:25 DEBUG Trying to verify hash for 3106249 bytes
2011-12-12 08:15:25 DEBUG The hash validated: yB1diojjYV7QIVrScro8sYwCD3yulPy0g/k8wnRY/Ue7HaHstyW1RXKfeF2Mlu/Cce4Cifrd/4iHe38pY+H5fA==
2011-12-12 08:15:25 DEBUG Completed download of NuGet package KH.HAPI.Web.CommerceServerTranslationService
2011-12-12 08:15:25 ERROR System.InvalidOperationException: Sequence contains no matching element
at System.Linq.Enumerable.First[TSource](IEnumerable1 source, Func2 predicate)
at Octopus.Server.Tasks.Deploy.DeployTaskExecutor.DownloadPackagesInThisRelease(IEnumerable1 packages, IList1 steps) in d:\TeamCity\Server\buildAgent\work\508f7e6149799a54\source\Octopus.Server\Tasks\Deploy\DeployTaskExecutor.cs:line 68
at Octopus.Server.Tasks.Deploy.DeployTaskExecutor.Execute(String arguments) in d:\TeamCity\Server\buildAgent\work\508f7e6149799a54\source\Octopus.Server\Tasks\Deploy\DeployTaskExecutor.cs:line 59
at Octopus.Server.Tasks.TaskQueue.<>c__DisplayClass3.b__0(Object ) in d:\TeamCity\Server\buildAgent\work\508f7e6149799a54\source\Octopus.Server\Tasks\TaskQueue.cs:line 89

Going back to the project definition, a gap can be seen in deployment steps, it skips straight over sequence number 2 (the package that was removed).

Reinserting the package into position two solves the problem.

Suggestion : when removing a package, make an option to remove it from existing release, and renumber the remaining package sequences so the sequence failure does not occur.

Hi Henning,

Sorry for not getting back to you sooner on this, Tender marked the conversation as spam.

I’ll see if I can reproduce this in the latest release, and try to get you a patch build soon!