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

Pipeline dies with `java.lang.String cannot be cast to hudson.model.Fingerprint`

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • core

      All builds that I checked fail with following stack :

      java.lang.ClassCastException: java.lang.String cannot be cast to hudson.model.Fingerprint
       at hudson.model.Fingerprint.load(Fingerprint.java:1369)
       at hudson.model.Fingerprint.load(Fingerprint.java:1357)
       at hudson.model.FingerprintMap.load(FingerprintMap.java:97)
       at hudson.model.FingerprintMap.load(FingerprintMap.java:47)
       at hudson.util.KeyedDataStorage.get(KeyedDataStorage.java:161)
       at hudson.model.FingerprintMap.get(FingerprintMap.java:82)
       at hudson.model.FingerprintMap.get(FingerprintMap.java:47)
       at hudson.util.KeyedDataStorage.getOrCreate(KeyedDataStorage.java:111)
       at hudson.model.FingerprintMap.getOrCreate(FingerprintMap.java:68)
       at hudson.model.FingerprintMap.getOrCreate(FingerprintMap.java:64)
       at com.cloudbees.plugins.credentials.CredentialsProvider.getOrCreateFingerprintOf(CredentialsProvider.java:1403)
       at com.cloudbees.plugins.credentials.CredentialsProvider.trackAll(CredentialsProvider.java:1457)
       at com.cloudbees.plugins.credentials.CredentialsProvider.track(CredentialsProvider.java:1421)
       at hudson.plugins.git.GitSCM.createClient(GitSCM.java:818)
       at hudson.plugins.git.GitSCM.createClient(GitSCM.java:786)
       at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1154)
       at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:113)
       at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:144)
       at org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:120)
       at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:298)
       at hudson.model.ResourceController.execute(ResourceController.java:97)
       at hudson.model.Executor.run(Executor.java:429)
       Finished: FAILURE

          [JENKINS-51179] Pipeline dies with `java.lang.String cannot be cast to hudson.model.Fingerprint`

          Witold Konior created issue -
          Witold Konior made changes -
          Description Original: All builds that I checked fail with following stack :

          ```
          java.lang.ClassCastException: java.lang.String cannot be cast to hudson.model.Fingerprint
          at hudson.model.Fingerprint.load(Fingerprint.java:1369)
          at hudson.model.Fingerprint.load(Fingerprint.java:1357)
          at hudson.model.FingerprintMap.load(FingerprintMap.java:97)
          at hudson.model.FingerprintMap.load(FingerprintMap.java:47)
          at hudson.util.KeyedDataStorage.get(KeyedDataStorage.java:161)
          at hudson.model.FingerprintMap.get(FingerprintMap.java:82)
          at hudson.model.FingerprintMap.get(FingerprintMap.java:47)
          at hudson.util.KeyedDataStorage.getOrCreate(KeyedDataStorage.java:111)
          at hudson.model.FingerprintMap.getOrCreate(FingerprintMap.java:68)
          at hudson.model.FingerprintMap.getOrCreate(FingerprintMap.java:64)
          at com.cloudbees.plugins.credentials.CredentialsProvider.getOrCreateFingerprintOf(CredentialsProvider.java:1403)
          at com.cloudbees.plugins.credentials.CredentialsProvider.trackAll(CredentialsProvider.java:1457)
          at com.cloudbees.plugins.credentials.CredentialsProvider.track(CredentialsProvider.java:1421)
          at hudson.plugins.git.GitSCM.createClient(GitSCM.java:818)
          at hudson.plugins.git.GitSCM.createClient(GitSCM.java:786)
          at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1154)
          at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:113)
          at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:144)
          at org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:120)
          at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:298)
          at hudson.model.ResourceController.execute(ResourceController.java:97)
          at hudson.model.Executor.run(Executor.java:429)
          Finished: FAILURE
          ```
          New: All builds that I checked fail with following stack :
          {code:java}
          java.lang.ClassCastException: java.lang.String cannot be cast to hudson.model.Fingerprint
           at hudson.model.Fingerprint.load(Fingerprint.java:1369)
           at hudson.model.Fingerprint.load(Fingerprint.java:1357)
           at hudson.model.FingerprintMap.load(FingerprintMap.java:97)
           at hudson.model.FingerprintMap.load(FingerprintMap.java:47)
           at hudson.util.KeyedDataStorage.get(KeyedDataStorage.java:161)
           at hudson.model.FingerprintMap.get(FingerprintMap.java:82)
           at hudson.model.FingerprintMap.get(FingerprintMap.java:47)
           at hudson.util.KeyedDataStorage.getOrCreate(KeyedDataStorage.java:111)
           at hudson.model.FingerprintMap.getOrCreate(FingerprintMap.java:68)
           at hudson.model.FingerprintMap.getOrCreate(FingerprintMap.java:64)
           at com.cloudbees.plugins.credentials.CredentialsProvider.getOrCreateFingerprintOf(CredentialsProvider.java:1403)
           at com.cloudbees.plugins.credentials.CredentialsProvider.trackAll(CredentialsProvider.java:1457)
           at com.cloudbees.plugins.credentials.CredentialsProvider.track(CredentialsProvider.java:1421)
           at hudson.plugins.git.GitSCM.createClient(GitSCM.java:818)
           at hudson.plugins.git.GitSCM.createClient(GitSCM.java:786)
           at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1154)
           at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:113)
           at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:144)
           at org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:120)
           at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:298)
           at hudson.model.ResourceController.execute(ResourceController.java:97)
           at hudson.model.Executor.run(Executor.java:429)
           Finished: FAILURE{code}
          Witold Konior made changes -
          Priority Original: Minor [ 4 ] New: Critical [ 2 ]

          Oleg Nenashev added a comment -

          Likely the Fingerprint file is corrupted (or uses wrong XML notation)
          Please provide...

          • Version of Jenkins
          • Failing fingerprint file if you can determine it (probably not)

          The error does not get propagated correctly in the code, and the unchecked cast is a bad idea. It needs some polishing at least.

          JENKINS-49588 may be related

          Oleg Nenashev added a comment - Likely the Fingerprint file is corrupted (or uses wrong XML notation) Please provide... Version of Jenkins Failing fingerprint file if you can determine it (probably not) The error does not get propagated correctly in the code, and the unchecked cast is a bad idea. It needs some polishing at least. JENKINS-49588 may be related
          Oleg Nenashev made changes -
          Link New: This issue relates to JENKINS-49588 [ JENKINS-49588 ]

          Oliver Rau added a comment -

          Hi Oleg,

          we are seeing the same issue at the moment.
          Jenkins Version is 2.112

          I assume that in our case this has happened after the disk being full and Jenkins getting into an inconsistent state. Jenkins was still working but wasn't accepting webhook builds anymore. After freeing up some space, It started accepting webhooks again but is now failing with the above exception.

          Is there any way to get it valid again without restarting Jenkins?

          Oliver Rau added a comment - Hi Oleg, we are seeing the same issue at the moment. Jenkins Version is 2.112 I assume that in our case this has happened after the disk being full and Jenkins getting into an inconsistent state. Jenkins was still working but wasn't accepting webhook builds anymore. After freeing up some space, It started accepting webhooks again but is now failing with the above exception. Is there any way to get it valid again without restarting Jenkins?

          Oleg Nenashev added a comment -

          According to the current stacktrace, you "just" need to find corrupted Fingerprint files and delete/move/fix them. The file is not loaded into the memory, so there should be no need in restart once the file is fixed somehow. If you delete it, a new file will be just created. You will lose track of credentials usage, but it should be flawless in other terms

          Oleg Nenashev added a comment - According to the current stacktrace, you "just" need to find corrupted Fingerprint files and delete/move/fix them. The file is not loaded into the memory, so there should be no need in restart once the file is fixed somehow. If you delete it, a new file will be just created. You will lose track of credentials usage, but it should be flawless in other terms

          Oliver Rau added a comment -

          Hi Oleg,

          Thanks for the reply. Here is what I've done to find existing files that are corrupted:

          grep -rL "</fingerprint>" $JENKINS_HOME/fingerprints

          I found two files, one of them empty, the other one indeed corrupted (not written to the end), so I deleted both. This didn't solve the issue.

          I restarted Jenkins, still no luck.

          Then I was digging down into where exactly the issue was occurring. I found that multiple withCredential blocks with different credentials were failing with above exception. As  I didn't know where else the fingerprint could be stored I simply updated that credentials and now builds are working again.

          Oliver Rau added a comment - Hi Oleg, Thanks for the reply. Here is what I've done to find existing files that are corrupted: grep -rL  "</fingerprint>" $JENKINS_HOME/fingerprints I found two files, one of them empty, the other one indeed corrupted (not written to the end), so I deleted both. This didn't solve the issue. I restarted Jenkins, still no luck. Then I was digging down into where exactly the issue was occurring. I found that multiple withCredential blocks with different credentials were failing with above exception. As  I didn't know where else the fingerprint could be stored I simply updated that credentials and now builds are working again.
          Oleg Nenashev made changes -
          Assignee New: Oleg Nenashev [ oleg_nenashev ]
          Oleg Nenashev made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]

            oleg_nenashev Oleg Nenashev
            jozue_noon Witold Konior
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: