Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-33254

Promoting Builds fail with: FATAL: Illegal choice:

      Promoting a build fails to run the promotion job and returns the error below. I have double checked the parameters for the job and everything seems to be in order. There are 8 parameters on the build. 6 are default values and 2 are selected from parameters dropdown before execution of the promotion. The drop down values are determined by Extensible choice, Global Choice Parameters.

      Started by user ***.*****
      Building in workspace /usr/share/tomcat7/.jenkins/workspace/svc-auto-build
      Promoting svc-auto-build #2637 - master
      FATAL: Illegal choice:
      java.lang.IllegalArgumentException: Illegal choice:
      at jp.ikedam.jenkins.plugins.extensible_choice_parameter.ExtensibleChoiceParameterDefinition.createValueCommon(ExtensibleChoiceParameterDefinition.java:398)
      at jp.ikedam.jenkins.plugins.extensible_choice_parameter.ExtensibleChoiceParameterDefinition.createValue(ExtensibleChoiceParameterDefinition.java:431)
      at jp.ikedam.jenkins.plugins.extensible_choice_parameter.ExtensibleChoiceParameterDefinition.getDefaultParameterValue(ExtensibleChoiceParameterDefinition.java:451)
      at hudson.plugins.parameterizedtrigger.DefaultParameterValuesActionsTransform.getDefaultParameters(DefaultParameterValuesActionsTransform.java:28)
      at hudson.plugins.parameterizedtrigger.DefaultParameterValuesActionsTransform.transformParametersAction(DefaultParameterValuesActionsTransform.java:15)
      at hudson.plugins.parameterizedtrigger.ProjectSpecificParametersActionFactory.getProjectSpecificBuildActions(ProjectSpecificParametersActionFactory.java:33)
      at hudson.plugins.parameterizedtrigger.BuildTriggerConfig.getBuildActions(BuildTriggerConfig.java:351)
      at hudson.plugins.parameterizedtrigger.BuildTriggerConfig.perform3(BuildTriggerConfig.java:419)
      at hudson.plugins.parameterizedtrigger.BlockableBuildTriggerConfig.perform3(BlockableBuildTriggerConfig.java:66)
      at hudson.plugins.parameterizedtrigger.TriggerBuilder.perform(TriggerBuilder.java:88)
      at hudson.plugins.promoted_builds.Promotion$RunnerImpl.build(Promotion.java:345)
      at hudson.plugins.promoted_builds.Promotion$RunnerImpl.doRun(Promotion.java:287)
      at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:537)
      at hudson.model.Run.execute(Run.java:1741)
      at hudson.model.Run.run(Run.java:1679)
      at hudson.plugins.promoted_builds.Promotion.run(Promotion.java:232)
      at hudson.model.ResourceController.execute(ResourceController.java:98)
      at hudson.model.Executor.run(Executor.java:408)
      Finished: FAILURE

          [JENKINS-33254] Promoting Builds fail with: FATAL: Illegal choice:

          Oleg Nenashev added a comment -

          Could you please provide the job configuration file?
          It smells like a bug in Extensible Choice Plugin, but I need to confirm it.

          Oleg Nenashev added a comment - Could you please provide the job configuration file? It smells like a bug in Extensible Choice Plugin, but I need to confirm it.

          Oleg, Thanks for looking into it.

          config.xml is now attached.

          Stephen Nichols added a comment - Oleg, Thanks for looking into it. config.xml is now attached.

          ikedam added a comment -

          I have ever seen this situation, which turned out caused for broken and inconsistent configurations originally caused for JENKINS-27505.
          JENKINS-27505 is an issue of Jenkins core, and fixed with Jenkins 1.639.

          It happens with a following case:

          • You put an empty value on the top of choices.
          • You select the empty value for the default value. (not with the "<Top Most Value>")
          • You trigger the project automatically (like with SCM polling, or parameterized-trigger plugin).

          It happens in this way:

          • When you open the system configuration page, the top empty value is removed for JENKINS-27505. It can be removed from the configuration unintentionally when you save the system configuration.
          • The project tries to launch with the empty value as it's configured as the default value.
          • Throws an exception as the value isn't listed in choices.

          If it is your case:
          How to fix:

          • Visit the system configuration page and add the empty value again.

          How to prevent reproduction:
          A. upgrade your Jenkins to the latest one. I recommend you to install a LTS version.
          B. add an empty choice to a place other than the topmost. You can list the same value twice.
          C. Make the parameter editable. It prevents exceptions even for values not listed in choices.
          .

          ikedam added a comment - I have ever seen this situation, which turned out caused for broken and inconsistent configurations originally caused for JENKINS-27505 . JENKINS-27505 is an issue of Jenkins core, and fixed with Jenkins 1.639. It happens with a following case: You put an empty value on the top of choices. You select the empty value for the default value. (not with the "<Top Most Value>") You trigger the project automatically (like with SCM polling, or parameterized-trigger plugin). It happens in this way: When you open the system configuration page, the top empty value is removed for JENKINS-27505 . It can be removed from the configuration unintentionally when you save the system configuration. The project tries to launch with the empty value as it's configured as the default value. Throws an exception as the value isn't listed in choices. If it is your case: How to fix: Visit the system configuration page and add the empty value again. How to prevent reproduction: A. upgrade your Jenkins to the latest one. I recommend you to install a LTS version. B. add an empty choice to a place other than the topmost. You can list the same value twice. C. Make the parameter editable. It prevents exceptions even for values not listed in choices. .

          adding an empty value to extensible choice options fixed the promotion issue. Thanks for the feedback ikedam.

          Is this still considered a bug that could be fixed or should I close this issue?

          Stephen Nichols added a comment - adding an empty value to extensible choice options fixed the promotion issue. Thanks for the feedback ikedam. Is this still considered a bug that could be fixed or should I close this issue?

          ikedam added a comment -

          it's not a bug of the plugin, but a bug of Jenkins core and fixed with JENKINS-27505.
          It is an intented behavior to throw an exception when a build tries to use a value not in choices.

          ikedam added a comment - it's not a bug of the plugin, but a bug of Jenkins core and fixed with JENKINS-27505 . It is an intented behavior to throw an exception when a build tries to use a value not in choices.

            ikedam ikedam
            snichols Stephen Nichols
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: