"Sequence contains more than one matching element" error when creating a release in the CLI when release versioning set to a referenced package on a step that includes a deployment package
Team
- [X] I've assigned a team label to this issue
Severity
Not blocking, at least 1 affected customer
Version
Tested in 2021.3.8275
Latest Version
No response
What happened?
"Sequence contains more than one matching element" error when creating a release in the CLI when release versioning set to a referenced package on a step that includes a deployment package
Reproduction
Related to 7283
- Create a
Run a Scriptstep withInline source code - Set a
Referenced Package - Go to
Deployments->Settingsfor the Project ->Use the version number from an included package - Select the package from Step 2 above
- Go back to the
Run a Scriptstep, switch toScript file inside a package, and save - Attempt to create a release from the CLI
- Example:
octo create-release --server=http://Your_Octopus_Server --apikey=API-XXXXXXXXXXXXXXXXXXXXXXXXX --project="project_name"
- Example:
Error and Stacktrace
System.InvalidOperationException: Sequence contains more than one matching element
at System.Linq.ThrowHelper.ThrowMoreThanOneMatchException()
at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
at Octopus.Cli.Commands.Releases.ReleasePlan.GetActionVersionNumber(String packageStepName, String packageReferenceName)
at Octopus.Cli.Commands.Releases.CreateReleaseCommand.Request()
at Octopus.Cli.Commands.ApiCommand.Execute()
at Octopus.Cli.Commands.ApiCommand.Execute(String[] commandLineArguments)
at Octopus.Cli.CliProgram.Run(String[] args)
Exit code: -3
More Information
No response
Workaround
Create a release via the Octopus Server UI rather than the CLI
or
Create a placeholder step such as the example below:



Unable to reproduce this issue based on the steps provided:

Based on the error message I would have expected multiple packages to have been defined. Do you have a cloud instance up I can test this against?
@zentron I fixed the instructions
Thanks @donnybell , that seems to have helped me reproduce it