jenkinsci / jenkinsci/workflow-multibranch-plugin

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

Open
#473 4 comments 0 reactions 0 assignees View on GitHub
component:workflow-multibranch-plugin imported-jira-issue priority:minor resolution:unresolved
Dominant language
Java
Stars
87
Forks
131
PR merge metrics
No merged PRs in 30d

Description

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)

---
Originally reported by rmyung, imported from: first build of a pull request fails with stderr: fatal: Couldn't find remote ref


  • status: Open
  • priority: Minor
  • component(s): workflow-multibranch-plugin
  • resolution: Unresolved
  • votes: 7
  • watchers: 12
  • imported: 20251212-090250

Raw content of original issue

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)


  • environment: Bitbucket

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.