question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to create new multibranch pipeline project (Error while loading repositories from cache)

See original GitHub issue

Your checklist for this issue

  • Jenkins version: 2.250.0

  • Plugin version: 2.8.0, 2.9.1

  • Bitbucket cloud

  • Bitbucket server and version: v6.10.0

Description

After upgrading to 2.8.0 (and now 2.9.1)

I’m trying to create a new multibranch pipeline job. I have already configured a Bitbucket Server Endpoint in the Jenkins System Configuration.

When configuring the branch source, after clicking on the “Add source” button and selecting “Bitbucket” I have the following problem:

I select the credentials as usual, and set the project name. Then, iteration of the repositories (to fill the dropdown) fails with the error message “Error while loading repositories from cache”.

This used to work previously (before updating to version 2.8.0 of this plugin).


Workaround:

I can create a copy of an existing job (which I configured before the update), then selecting a repository works as usual.


Additional info: After some searching on my own, it seems that the serverUrl of the BitbucketSCMSource somehow gets defaulted to https://bitbucket.org (as seen in the new jobs config.xml).

Logs show entries like this (sanitized):

Jul 30, 2020 2:42:51 PM FINE com.cloudbees.jenkins.plugins.bitbucket.api.credentials.BitbucketUsernamePasswordAuthenticator
Add host=https://api.bitbucket.org to authCache.
Jul 30, 2020 2:42:51 PM FINE com.cloudbees.jenkins.plugins.bitbucket.client.BitbucketCloudApiClient
Jenkins proxy: xxxxxxxxx.xxx/xx.xx.xx.xx:xxxx
Jul 30, 2020 2:42:51 PM FINE com.cloudbees.jenkins.plugins.bitbucket.client.BitbucketCloudApiClient
Using proxy authentication (user=xxxxxxxxxxxxxxxxxxx)
Jul 30, 2020 2:42:51 PM SEVERE com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource$DescriptorImpl doFillRepositoryItems
Error while loading repositories from cache
com.cloudbees.jenkins.plugins.bitbucket.api.BitbucketRequestException: HTTP request error. Status: 407: Proxy Authentication Required.
<snip html response>

	at com.cloudbees.jenkins.plugins.bitbucket.client.BitbucketCloudApiClient.getRequestAsInputStream(BitbucketCloudApiClient.java:918)
	at com.cloudbees.jenkins.plugins.bitbucket.client.BitbucketCloudApiClient.getRequest(BitbucketCloudApiClient.java:930)
	at com.cloudbees.jenkins.plugins.bitbucket.client.BitbucketCloudApiClient.lambda$getRepositories$4(BitbucketCloudApiClient.java:774)
	at com.cloudbees.jenkins.plugins.bitbucket.client.BitbucketCloudApiClient.getRepositories(BitbucketCloudApiClient.java:790)
Caused: java.io.IOException: Error while loading repositories from cache
	at com.cloudbees.jenkins.plugins.bitbucket.client.BitbucketCloudApiClient.getRepositories(BitbucketCloudApiClient.java:793)
	at com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource$DescriptorImpl.doFillRepositoryItems(BitbucketSCMSource.java:1215)
	at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627)
	at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:396)
	at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:408)
	at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:212)
	at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:145)
	at org.kohsuke.stapler.MetaClass$11.doDispatch(MetaClass.java:536)
	at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:766)
	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:898)
	at org.kohsuke.stapler.MetaClass$4.doDispatch(MetaClass.java:281)
	at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:766)
	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:898)
	at org.kohsuke.stapler.MetaClass$4.doDispatch(MetaClass.java:281)
	at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:766)
	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:898)
	at org.kohsuke.stapler.MetaClass$4.doDispatch(MetaClass.java:281)
	at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:766)
	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:898)
	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:694)
	at org.kohsuke.stapler.Stapler.service(Stapler.java:240)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:763)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1631)
	at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:154)
	at jenkins.telemetry.impl.UserLanguages$AcceptLanguageFilter.doFilter(UserLanguages.java:129)
	at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151)
	at jenkins.security.ResourceDomainFilter.doFilter(ResourceDomainFilter.java:76)
	at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151)
	at org.jenkinsci.plugins.ssegateway.Endpoint$SSEListenChannelFilter.doFilter(Endpoint.java:248)
	at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151)
	at io.jenkins.blueocean.ResourceCacheControl.doFilter(ResourceCacheControl.java:134)
	at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151)
	at io.jenkins.blueocean.auth.jwt.impl.JwtAuthenticationFilter.doFilter(JwtAuthenticationFilter.java:61)
	at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151)
	at org.jenkinsci.plugins.modernstatus.ModernStatusFilter.doFilter(ModernStatusFilter.java:52)
	at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151)
	at hudson.plugins.locale.LocaleFilter.doFilter(LocaleFilter.java:42)
	at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151)
	at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:157)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1618)
	at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:153)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1618)
	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
	at hudson.security.UnwrapSecurityExceptionFilter.doFilter(UnwrapSecurityExceptionFilter.java:51)
	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
	at jenkins.security.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:119)
	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
	at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
	at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:142)
	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
	at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271)
	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
	at jenkins.security.BasicHeaderProcessor.doFilter(BasicHeaderProcessor.java:93)
	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
	at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
	at hudson.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.java:67)
	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
	at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:90)
	at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:171)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1618)
	at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:51)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1618)
	at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:82)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1618)
	at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1618)
	at jenkins.security.SuspiciousRequestFilter.doFilter(SuspiciousRequestFilter.java:36)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1618)
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:549)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:578)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235)
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1610)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1369)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:489)
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1580)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1284)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
	at org.eclipse.jetty.server.Server.handle(Server.java:501)
	at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:383)
	at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:556)
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:375)
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:272)
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
	at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:336)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:313)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:171)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:129)
	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:375)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:806)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:938)
	at java.lang.Thread.run(Thread.java:748)

I’m not sure why the plugin thinks this should be a Cloud Endpoint (as we have no configuration for those, just a single Server Endpoint), nor whether the (expected, at least for https://api.bitbucket.org) proxy error is throwing wrenches into some endpoint detection logic.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:12
  • Comments:21 (4 by maintainers)

github_iconTop GitHub Comments

9reactions
unencodedcommented, Sep 4, 2020

I confirm the bug. My setup is:

  • Jenkins: 2.255-1.1.noarch (CentOS Linux release 7.8.2003 (Core))
  • Bitbucket Plugin: 1.1.24
  • Bitbucket Branch Source Plugin: 2.9.2
  • Bitbucket Server: v6.10.0

@hoffmale , your fix works fine

Manually exchanging the serverUrl in a job’s config.xml works, as does copying an already existing job.

Enough to replace https://bitbucket.org to your own bitbucket server URL in config.xml and then do the reread Jenkins config from the Jenkins settings.

7reactions
tfeitorcommented, Sep 7, 2020

I have this problem too

Jenkins 2.253 Bitbucket Branch Source Plugin: 2.9.2 Bitbucket v7.1.3

When I try to create a new multibranch pipeline project, I have the following error:

Could not find: <project_key>

image

I got over this problem, adding the Bitbucket Cloud endpoint in Jenkins > Config

image

And, next when I try to create a new project, the repositories are returned correctly, when I select our Bitbucket Server.

Strangely, if I add two servers (prod / dev), without the Bitbucket Cloud server, the problem is also got over.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bitbucket branch source plugin doesn't update correctly the list ...
In a Multibranch Pipeline project when I add Bitbucket as a Branch Source, give it the correct Credentials and Owner, the repo that...
Read more >
Jenkins could NOT discover Repositories - Atlassian Community
I just started seeing this error this morning(Could not resolve team details) : [Thu Aug 26 10:14:35 CDT 2021] Starting organization scan.
Read more >
Jenkins MultiBranch Pipeline git config error - Stack Overflow
1 Answer 1 · Go to $JENKINS_HOME/caches (on windows it is probably C:\Program Files (x86)\Jenkins\caches) - You will find a few caches, each...
Read more >
jenkinsci/bitbucket-branch-source-plugin - Gitter
But i get the error "Error while loading repositories from cache" . If I use not my private username but a team name...
Read more >
Bitbucket Branch Source does not recognize my repositories
This issue will only cause a problem for new BitBucket projects or if you try to re-save the configuration of an existing BitBucket...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found