ghprb-plugin: Retest PR cause Github API call failed with 404

After comments on a Github PR “retest this please”. Jenkins could not rebuild, and the following exception is logged in Jenkins log page.

It might be https://api.github.com/repos/<UserName>/<RepoName>/pulls/4/commits .

  • Plugin version: 1.33.2
A thread (Thread-9/80) died unexpectedly due to an uncaught exception, this may leave your Jenkins in a bad way and is usually indicative of a bug in the code.
java.lang.Error: java.io.FileNotFoundException: {"message":"Not Found","documentation_url":"https://developer.github.com/v3"}
	at org.kohsuke.github.Requester$PagingIterator.fetch(Requester.java:433)
	at org.kohsuke.github.Requester$PagingIterator.hasNext(Requester.java:400)
	at org.kohsuke.github.PagedIterator.fetch(PagedIterator.java:44)
	at org.kohsuke.github.PagedIterator.hasNext(PagedIterator.java:32)
	at org.jenkinsci.plugins.ghprb.GhprbPullRequest.tryBuild(GhprbPullRequest.java:365)
	at org.jenkinsci.plugins.ghprb.GhprbPullRequest.check(GhprbPullRequest.java:214)
	at org.jenkinsci.plugins.ghprb.GhprbRepository.onIssueCommentHook(GhprbRepository.java:346)
	at org.jenkinsci.plugins.ghprb.GhprbTrigger.handleComment(GhprbTrigger.java:618)
	at org.jenkinsci.plugins.ghprb.GhprbRootAction$1.run(GhprbRootAction.java:233)
Caused by: java.io.FileNotFoundException: {"message":"Not Found","documentation_url":"https://developer.github.com/v3"}
	at org.kohsuke.github.Requester.handleApiError(Requester.java:592)
	at org.kohsuke.github.Requester$PagingIterator.fetch(Requester.java:429)
	... 8 more
Caused by: java.io.FileNotFoundException: https://api.github.com/repos/<UserName>/<RepoName>/issues/4/commits
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1926)
	at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1921)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1920)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1490)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474)
	at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
	at org.kohsuke.github.Requester.parse(Requester.java:524)
	at org.kohsuke.github.Requester.access$200(Requester.java:68)
	at org.kohsuke.github.Requester$PagingIterator.fetch(Requester.java:424)
	... 8 more
Caused by: java.io.FileNotFoundException: https://api.github.com/repos/<UserName>/<RepoName>/issues/4/commits
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1872)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474)
	at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
	at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:338)
	at org.kohsuke.github.Requester.parse(Requester.java:514)
	... 10 more

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 2
  • Comments: 44 (22 by maintainers)

Most upvoted comments

I have no label on my side. Currently:

  • PR are built when a new commit is pushed
  • PR are not built when there are created or when we request a build through a comment

Hi, I am also suffering from this issue. I’m using Github Enterprise 2.8 with Github Pull Request Builder plugin 1.33.2 (but, this also occurs at the master branch)

In my opinion, this is more complex issue because it related to github-api. This error is occurs at this point ( https://github.com/jenkinsci/ghprb-plugin/blob/master/src/main/java/org/jenkinsci/plugins/ghprb/GhprbPullRequest.java#L365 ) by calling listCommits.

But, github’s hook returns api url /repos/:user/:repo/issues/:pr_number not /repos/:user/:repo/pulls/:pr_number.

github-api project’s GHPullRequest implements are ( https://github.com/kohsuke/github-api/blob/master/src/main/java/org/kohsuke/github/GHPullRequest.java#L250 ). At this point, we neither could modify PR’s api url nor call user defined url.