Repository redirects in API v4 GraphQL


If a repo was changed, v3 would redirect the call automatically


However this doesn’t seem to happen in v4 and can’t find anything related to redirection or renaming in the docs.

For example, this is the old URL:

And it’s redirected to:

But this GraphQL errors:

  repository(owner: "domchristie", name: "to-markdown") {
    pullRequest(number: 187) {


Thanks, @bfred-it, that’s a good observation. This does seem like a discrepancy that should be addressed!

I’ve opened up an issue for it internally, and we’ll ping back here when we’ve got updates.


I am sorry, but is this issue still outstanding or has a fix been put in place yet?


+1, any suggestions how to deal with this, or any ETA when this will be tackled from Github side @kytrinyx ? This is very pesky to deal with as it stands, since repo references can just vanish and as opposed to the way this worked on v3 they won’t magically “auto-heal”


Hi @robbywashere and @colszowka, thanks for the bump on this. We’ve re-prioritized the issue internally.

One workaround would be to use the Global Relay ID to identify the repo, since that will remain the same no matter what. However, you can’t use this to backtrack from a repo reference that has vanished - you’ll have to have the ID before the repo is renamed.


@rlinehan Thanks for the update! Unfortunately, in my case the relay ID will not help since I’m getting the repo reference from rubygems metadata, and so no way for me to upfront find the relay ID


Ah, got it. That makes a lot of sense, and the information about your use case helps us prioritize this. Thanks!


That’s great to hear, thank you! For now I hacked around the issue by issuing a single http HEAD request to the actual repo url, which gives me all the info to handle the repo data, but I’d really prefer to use an official solution :slight_smile:


Any update on official support for redirect?