Bitbucket branch source fails with more than 200 branches

1 minute readKnowledge base

Issue

Jobs using the Bitbucket Branch Source plugin fail with the following error:

java.lang.InterruptedException
        at com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient.getResource(BitbucketServerAPIClient.java:910)
        at com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient.getSingleBranch(BitbucketServerAPIClient.java:642)
        at com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient.getBranch(BitbucketServerAPIClient.java:592)
        at com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient.getBranch(BitbucketServerAPIClient.java:131)
        at com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource.retrieve(BitbucketSCMSource.java:912)
        at jenkins.scm.api.SCMSource.fetch(SCMSource.java:581)
        at org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:99)
        at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:311)
        at hudson.model.ResourceController.execute(ResourceController.java:101)
        at hudson.model.Executor.run(Executor.java:442)
Finished: FAILURE

Resolution

Upgrade to CloudBees CI 2.426.1.2 or later (CloudBees CI release notes).

Workaround

Reduce the number of branches in the repository to 200 or fewer.

This article is part of our Knowledge Base and is provided for guidance-based purposes only. The solutions or workarounds described here are not officially supported by CloudBees and may not be applicable in all environments. Use at your own discretion, and test changes in a safe environment before applying them to production systems.