Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

install_github with non-default host broken: "attempt to set an attribute on NULL" #396

r-cheologist opened this issue Jul 8, 2019 · 3 comments


Copy link

r-cheologist commented Jul 8, 2019

Consider the following:

  repo = 'loosolab/MARMoSET', host = '')

This fails with the error:

Error: Failed to install 'MARMoSET' from GitHub:
  attempt to set an attribute on NULL

This happens both with the current cran version and after invoking remotes::install_github("r-lib/remotes").

Copy link

dpprdan commented Jul 31, 2019

The error message is caused by ratelimit_reset <- .POSIXct(res_headers$x-ratelimit-reset, tz = "UTC") in github_error since this server apparently does not return a x-ratelimit-reset in its header, so res_headers$`x-ratelimit-reset = NULL`. I gather that for this server the REST API rate limit is not set. In any case, this seems to be possible according to the docs:

Note that the limits mentioned above are the default rate limits for a GitHub Enterprise Server instance. Contact your site administrator to confirm if rate limits are enabled and how they are configured.

Emphasis mine.

With my attempt to fix this applied (#413), we now get

  repo = "loosolab/MARMoSET", host = ""
#> Error: Failed to install 'unknown package' from GitHub:
#>   HTTP error 401.
#>   Bad credentials

This is because install_github() uses the auth_token = github_pat() default.

Unfortunately auth_token = NULL does not help (yet).

  repo = "loosolab/MARMoSET", host = "", 
  auth_token = NULL
#> Error: Failed to install 'unknown package' from GitHub:
#>   HTTP error 401.
#>   Bad credentials

This is because remote_package_name.github_remote calls github_DESCRIPTION() with pat = remote$auth_token %||% github_pat(). So since auth_token = NULL, github_DESCRIPTION() essentially tries to access the DESCRIPTION file on the host with the PAT from the GITHUB_PAT environment variable (which is likely to be the one for Since does not require a PAT, we get the 401 error.

Since @jimhester deliberately set %||% github_pat() in commit 203d06e, I don't know how to solve this without breaking other things at this moment.

For now, a workaround for this particular case is:

  repo = "loosolab/MARMoSET", host = ""

Copy link

reikoch commented Oct 3, 2019

I encountered a similar problem:
my GITHUB_PAT environment variable contained the PAT for and that effectively disabled installations from our github enterprise server.

Somehow I think the PATs have to be linked to the corresponding host: PAT1 PAT2

Copy link

jimhester commented Apr 3, 2020

Fixed by #413

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

No branches or pull requests

4 participants