Skip to content

"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 #7359

@donnybell

Description

@donnybell

Team

  • 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

  1. Create a Run a Script step with Inline source code
  2. Set a Referenced Package
  3. Go to Deployments -> Settings for the Project -> Use the version number from an included package
  4. Select the package from Step 2 above
  5. Go back to the Run a Script step, switch to Script file inside a package, and save
  6. Attempt to create a release from the CLI
    • Example: octo create-release --server=http://Your_Octopus_Server --apikey=API-XXXXXXXXXXXXXXXXXXXXXXXXX --project="project_name"

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:
image

image

image

Metadata

Metadata

Labels

kind/bugThis issue represents a verified problem we are committed to solvingp3state/fruitbowlIntroductory tickets to the Octopus Deploy codebase for new starters or anyone wanting a 'quick win'

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions