-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Major
-
Component/s: bitbucket-branch-source-plugin
-
None
-
Environment:Jenkins version: 2.479.3
Bitbucket Branch Source Plugin version: 935.1.3
Bitbucket Data Center version: 8.19.14
-
936.4.2
We are experiencing repeated 401 Unauthorized errors when Jenkins attempts to access Bitbucket repositories using the Bitbucket Branch Source Plugin. This issue started occurring very frequent since Feb 2025.
The errors appear during branch indexing and job execution, and are consistent across different repositories. The responses from Bitbucket indicate an AuthorisationException, despite valid credentials and previously working configuration. When we run the job again, it works without any changes.Â
Also why OAuth authentication is being used?
Observed Jenkins Log Output:
com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource getProjectKey
Failure getting the project key of repository <repo_name_redacted> :
HTTP request error.
Status: HTTP/1.1 401
Response: {
 "errors": [
  {
   "context": null,
   "message": "You are not permitted to access this resource",
   "exceptionName": "com.atlassian.bitbucket.AuthorisationException"
  }
 ]
}
Server: nginx/1.26.0
Date: Mon, 24 Mar 2025 10:12:15 GMT
WWW-Authenticate: OAuth realm="https%3A%2F%2F<bitbucket-hostname-redacted>"
Set-Cookie: BITBUCKETSESSIONID=[REDACTED]
Observed Job Console Output:
17:10:05Â Branch event17:10:05Â com.cloudbees.jenkins.plugins.bitbucket.api.BitbucketRequestException: HTTP request error.17:10:05Â Status: HTTP/1.1 40117:10:05Â Response: {"errors":[{"context":null,"message":"You are not permitted to access this resource","exceptionName":"com.atlassian.bitbucket.AuthorisationException"}]}17:10:05Â Server: nginx/1.26.017:10:05Â Date: Sun, 23 Mar 2025 16:10:05 GMT17:10:05Â Content-Type: application/json;charset=UTF-817:10:05Â Transfer-Encoding: chunked17:10:05Â Connection: keep-alive17:10:05Â X-AREQUESTID: <redacted>:10:05Â Set-Cookie: BITBUCKETSESSIONID=<redacted>; Max-Age=1209600; Expires=Sun, 06 Apr 2025 16:10:05 GMT; Path=/; Secure; HttpOnly17:10:05Â X-ASESSIONID: 130unb17:10:05Â Cache-Control: private, no-cache17:10:05Â Pragma: no-cache17:10:05Â Cache-Control: no-cache, no-transform17:10:05Â Vary: x-ausername,x-auserid,cookie,accept-encoding17:10:05Â WWW-Authenticate: OAuth realm="https%3A%2F%2F<bitbucket-hostname-redacted>"17:10:05Â Â Â at PluginClassLoader for cloudbees-bitbucket-branch-source//com.cloudbees.jenkins.plugins.bitbucket.impl.client.AbstractBitbucketApi.buildResponseException(AbstractBitbucketApi.java:90)17:10:05Â Â Â at PluginClassLoader for cloudbees-bitbucket-branch-source//com.cloudbees.jenkins.plugins.bitbucket.impl.client.AbstractBitbucketApi.doRequest(AbstractBitbucketApi.java:237)17:10:05Â Â Â at PluginClassLoader for cloudbees-bitbucket-branch-source//com.cloudbees.jenkins.plugins.bitbucket.impl.client.AbstractBitbucketApi.doRequest(AbstractBitbucketApi.java:250)17:10:05Â Â Â at PluginClassLoader for cloudbees-bitbucket-branch-source//com.cloudbees.jenkins.plugins.bitbucket.impl.client.AbstractBitbucketApi.getRequest(AbstractBitbucketApi.java:292)17:10:05Â Â Â at PluginClassLoader for cloudbees-bitbucket-branch-source//com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient.getResource(BitbucketServerAPIClient.java:905)17:10:05Â Â Â at PluginClassLoader for cloudbees-bitbucket-branch-source//com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient.getSingleBranch(BitbucketServerAPIClient.java:625)17:10:05Â Â Â at PluginClassLoader for cloudbees-bitbucket-branch-source//com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient.getBranch(BitbucketServerAPIClient.java:590)17:10:05Â Â Â at PluginClassLoader for cloudbees-bitbucket-branch-source//com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient.getBranch(BitbucketServerAPIClient.java:110)17:10:05Â Â Â at PluginClassLoader for cloudbees-bitbucket-branch-source//com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource.retrieve(BitbucketSCMSource.java:925)17:10:05Â Â Â at PluginClassLoader for scm-api//jenkins.scm.api.SCMSource.fetch(SCMSource.java:581)17:10:05Â Â Â at PluginClassLoader for workflow-multibranch//org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:104)17:10:05Â Â Â at PluginClassLoader for workflow-job//org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:319)17:10:05Â Â Â at hudson.model.ResourceController.execute(ResourceController.java:101)17:10:05Â Â Â at hudson.model.Executor.run(Executor.java:445)17:10:06Â Finished: FAILURE
Â
Â
- is duplicated by
-
JENKINS-75216 Unable to get password from credentials during git fetch using App password
-
- Closed
-
-
JENKINS-75808 Scan Multibranch pipeline credential usage
-
- Closed
-
- links to