java.lang.ClassCastException: hudson.model.labels.LabelExpression$And cannot be cast to hudson.model.labels.LabelAtom

Jenkins JIRA | Mikko Tapaninen | 4 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    We noticed problems with using label expression as "Node". In our case we used value "build&&machine (group of machine_1,...)". Once the build started, Jenkins started to loose the slave executors. They failed with: {code} SEVERE: Timer task hudson.model.Queue$MaintainTask@15db104e failed java.lang.ClassCastException: hudson.model.labels.LabelExpression$And cannot be cast to hudson.model.labels.LabelAtom at jenkins.model.Jenkins.getLabelAtom(Jenkins.java:1571) at hudson.model.labels.LabelAtom.get(LabelAtom.java:224) at hudson.model.labels.LabelExpressionParser.term6(LabelExpressionParser.java:208) at hudson.model.labels.LabelExpressionParser.term5(LabelExpressionParser.java:164) at hudson.model.labels.LabelExpressionParser.term4(LabelExpressionParser.java:136) at hudson.model.labels.LabelExpressionParser.term3(LabelExpressionParser.java:113) at hudson.model.labels.LabelExpressionParser.term2(LabelExpressionParser.java:83) at hudson.model.labels.LabelExpressionParser.term1(LabelExpressionParser.java:60) at hudson.model.labels.LabelExpressionParser.expr(LabelExpressionParser.java:50) at hudson.model.Label.parseExpression(Label.java:509) at jenkins.model.Jenkins.getLabel(Jenkins.java:1553) at hudson.model.AbstractProject.getAssignedLabel(AbstractProject.java:356) at hudson.model.queue.MappingWorksheet$WorkChunk.getAssignedLabel(MappingWorksheet.java:202) at hudson.model.queue.MappingWorksheet$WorkChunk.<init>(MappingWorksheet.java:185) at hudson.model.queue.MappingWorksheet$WorkChunk.<init>(MappingWorksheet.java:157) at hudson.model.queue.MappingWorksheet.<init>(MappingWorksheet.java:375) at hudson.model.queue.MappingWorksheet.<init>(MappingWorksheet.java:303) at hudson.model.Queue.maintain(Queue.java:1033) at hudson.model.Queue$MaintainTask.doRun(Queue.java:1759) at hudson.triggers.SafeTimerTask.run(SafeTimerTask.java:54) at java.util.TimerThread.mainLoop(Timer.java:512) at java.util.TimerThread.run(Timer.java:462) Mar 26, 2013 1:12:52 PM hudson.triggers.SafeTimerTask run {code} I checked that running the following groovy script from console fails to our matrix project with the "matrix tie parent" plugin config above: {code} import jenkins.model.*; for(item in Jenkins.instance.items) { println("JOB: '" + item.name + "'"); if (item.getAssignedLabel() != null) { println("LABEL: '" + item.getAssignedLabel() + "'"); } } {code} The outcome is that all executors die (https://wiki.jenkins-ci.org/display/JENKINS/Dead+Executor) and we cannot restart those threads through the UI. Only after I changed the "Node" to "master" I was able to restart the executors. So this really kills the whole Jenkins instance.

    Jenkins JIRA | 4 years ago | Mikko Tapaninen
    java.lang.ClassCastException: hudson.model.labels.LabelExpression$And cannot be cast to hudson.model.labels.LabelAtom
  2. 0

    We noticed problems with using label expression as "Node". In our case we used value "build&&machine (group of machine_1,...)". Once the build started, Jenkins started to loose the slave executors. They failed with: {code} SEVERE: Timer task hudson.model.Queue$MaintainTask@15db104e failed java.lang.ClassCastException: hudson.model.labels.LabelExpression$And cannot be cast to hudson.model.labels.LabelAtom at jenkins.model.Jenkins.getLabelAtom(Jenkins.java:1571) at hudson.model.labels.LabelAtom.get(LabelAtom.java:224) at hudson.model.labels.LabelExpressionParser.term6(LabelExpressionParser.java:208) at hudson.model.labels.LabelExpressionParser.term5(LabelExpressionParser.java:164) at hudson.model.labels.LabelExpressionParser.term4(LabelExpressionParser.java:136) at hudson.model.labels.LabelExpressionParser.term3(LabelExpressionParser.java:113) at hudson.model.labels.LabelExpressionParser.term2(LabelExpressionParser.java:83) at hudson.model.labels.LabelExpressionParser.term1(LabelExpressionParser.java:60) at hudson.model.labels.LabelExpressionParser.expr(LabelExpressionParser.java:50) at hudson.model.Label.parseExpression(Label.java:509) at jenkins.model.Jenkins.getLabel(Jenkins.java:1553) at hudson.model.AbstractProject.getAssignedLabel(AbstractProject.java:356) at hudson.model.queue.MappingWorksheet$WorkChunk.getAssignedLabel(MappingWorksheet.java:202) at hudson.model.queue.MappingWorksheet$WorkChunk.<init>(MappingWorksheet.java:185) at hudson.model.queue.MappingWorksheet$WorkChunk.<init>(MappingWorksheet.java:157) at hudson.model.queue.MappingWorksheet.<init>(MappingWorksheet.java:375) at hudson.model.queue.MappingWorksheet.<init>(MappingWorksheet.java:303) at hudson.model.Queue.maintain(Queue.java:1033) at hudson.model.Queue$MaintainTask.doRun(Queue.java:1759) at hudson.triggers.SafeTimerTask.run(SafeTimerTask.java:54) at java.util.TimerThread.mainLoop(Timer.java:512) at java.util.TimerThread.run(Timer.java:462) Mar 26, 2013 1:12:52 PM hudson.triggers.SafeTimerTask run {code} I checked that running the following groovy script from console fails to our matrix project with the "matrix tie parent" plugin config above: {code} import jenkins.model.*; for(item in Jenkins.instance.items) { println("JOB: '" + item.name + "'"); if (item.getAssignedLabel() != null) { println("LABEL: '" + item.getAssignedLabel() + "'"); } } {code} The outcome is that all executors die (https://wiki.jenkins-ci.org/display/JENKINS/Dead+Executor) and we cannot restart those threads through the UI. Only after I changed the "Node" to "master" I was able to restart the executors. So this really kills the whole Jenkins instance.

    Jenkins JIRA | 4 years ago | Mikko Tapaninen
    java.lang.ClassCastException: hudson.model.labels.LabelExpression$And cannot be cast to hudson.model.labels.LabelAtom

    Root Cause Analysis

    1. java.lang.ClassCastException

      hudson.model.labels.LabelExpression$And cannot be cast to hudson.model.labels.LabelAtom

      at jenkins.model.Jenkins.getLabelAtom()
    2. jenkins.model
      Jenkins.getLabelAtom
      1. jenkins.model.Jenkins.getLabelAtom(Jenkins.java:1571)
      1 frame
    3. Hudson
      Label.parseExpression
      1. hudson.model.labels.LabelAtom.get(LabelAtom.java:224)
      2. hudson.model.labels.LabelExpressionParser.term6(LabelExpressionParser.java:208)
      3. hudson.model.labels.LabelExpressionParser.term5(LabelExpressionParser.java:164)
      4. hudson.model.labels.LabelExpressionParser.term4(LabelExpressionParser.java:136)
      5. hudson.model.labels.LabelExpressionParser.term3(LabelExpressionParser.java:113)
      6. hudson.model.labels.LabelExpressionParser.term2(LabelExpressionParser.java:83)
      7. hudson.model.labels.LabelExpressionParser.term1(LabelExpressionParser.java:60)
      8. hudson.model.labels.LabelExpressionParser.expr(LabelExpressionParser.java:50)
      9. hudson.model.Label.parseExpression(Label.java:509)
      9 frames
    4. jenkins.model
      Jenkins.getLabel
      1. jenkins.model.Jenkins.getLabel(Jenkins.java:1553)
      1 frame
    5. Hudson
      SafeTimerTask.run
      1. hudson.model.AbstractProject.getAssignedLabel(AbstractProject.java:356)
      2. hudson.model.queue.MappingWorksheet$WorkChunk.getAssignedLabel(MappingWorksheet.java:202)
      3. hudson.model.queue.MappingWorksheet$WorkChunk.<init>(MappingWorksheet.java:185)
      4. hudson.model.queue.MappingWorksheet$WorkChunk.<init>(MappingWorksheet.java:157)
      5. hudson.model.queue.MappingWorksheet.<init>(MappingWorksheet.java:375)
      6. hudson.model.queue.MappingWorksheet.<init>(MappingWorksheet.java:303)
      7. hudson.model.Queue.maintain(Queue.java:1033)
      8. hudson.model.Queue$MaintainTask.doRun(Queue.java:1759)
      9. hudson.triggers.SafeTimerTask.run(SafeTimerTask.java:54)
      9 frames
    6. Java RT
      TimerThread.run
      1. java.util.TimerThread.mainLoop(Timer.java:512)
      2. java.util.TimerThread.run(Timer.java:462)
      2 frames