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

first build of a pull request fails with stderr: fatal: Couldn't find remote ref

      We configured the workflow multibranch plugin with the option to "Discover pull requests from origin".  We've set this at both "current pull request revision" and "both".  When a pull request is created in Bitbucket, Jenkins creates the folder and view for the pull request, but the first build always fails.  It then works when manually triggered to build again.

      Here is an example error message:

      > git fetch --no-tags --progress https://bitbucket.athenahealth.com/scm/ANML/prediction-service-api.git +refs/pull-requests/12/from:refs/remotes/origin/PR-12
      ERROR: Error cloning remote repo 'origin'
      hudson.plugins.git.GitException: Command "git fetch --no-tags --progress https://bitbucket.athenahealth.com/scm/ANML/prediction-service-api.git +refs/pull-requests/12/from:refs/remotes/origin/PR-12" returned status code 128:
      stdout: 
      stderr: fatal: Couldn't find remote ref refs/pull-requests/12/from
      
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1924)
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1643)
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:71)
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:352)
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:559)
      	at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1075)
      	at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1115)
      	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:113)
      	at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:130)
      	at org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:120)
      	at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:263)
      	at hudson.model.ResourceController.execute(ResourceController.java:97)
      # 	at hudson.model.Executor.run(Executor.java:405)

          [JENKINS-46648] first build of a pull request fails with stderr: fatal: Couldn't find remote ref

          Any updates on this issue? I'm still getting this. I think that happens when a PR is closed/merged and Jenkins tries to fetch it out

          Stephan Vedder added a comment - Any updates on this issue? I'm still getting this. I think that happens when a PR is closed/merged and Jenkins tries to fetch it out

          This is also causing a large issue for us, unfrotunately after an upgrade to Bitbucket as well . Is there a fix or anyone working on this problem ?

           

          Martin Rheumer added a comment - This is also causing a large issue for us, unfrotunately after an upgrade to Bitbucket as well . Is there a fix or anyone working on this problem ?  

          Jean Araujo added a comment -

          Hello, we've got the same problem in our company. Also after a Bitbucket update. Hope you guys to find a fix

          Jean Araujo added a comment - Hello, we've got the same problem in our company. Also after a Bitbucket update. Hope you guys to find a fix

          For those of you getting this issue after Updating to bitbucket 7.0 you might want to watch this issue in github to follow how this issue will be fixed:
          https://github.com/jenkinsci/bitbucket-branch-source-plugin/issues/287

          Christopher Timm added a comment - For those of you getting this issue after Updating to bitbucket 7.0 you might want to watch this issue in github to follow how this issue will be fixed: https://github.com/jenkinsci/bitbucket-branch-source-plugin/issues/287

            Unassigned Unassigned
            rmyung Roger Myung
            Votes:
            7 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated: