Skip to content

Improved error message for private *dependency* errors #295

@bestdan

Description

@bestdan

BLUF:
Could we improve the error message for installing dependencies to:

  1. note when the 404 error comes from a dependency, not the main repo
  2. suggest the user switches to the Sys.setenv("GITHUB_PAT" = ###) method for multiple private installs
  3. potentially pass the auth_token down to the private dependency repo call

Imagine your installing a package using remotes::install_github("foo", auth_token = "###"), and you get this error message:

Downloading GitHub repo foo
Error: HTTP error 404.
  Not Found

  Rate limit remaining: 50/60
  Rate limit reset at: 2019-02-14 15:39:37 UTC

You might spend a bit of time confused if:

  1. the foo repo is not private
  2. foo is private, but you supplied a valid auth token.

If foo has dependency bar, then it's actually bar which is 404'ing.

If a repo/package has a dependency which is a private repo, and you supply a github token as an argument to the install_github(auth_token), the auth_token is not passed to installing the dependencies. Traceback below.

Traceback()

traceback()
16: stop(github_error(res))
15: github_commit(username = remote$username, repo = remote$repo, 
        host = remote$host, ref = remote$ref, pat = remote$auth_token %||% 
            github_pat(), use_curl = use_curl)
14: remote_sha.github_remote(x)
13: remote_sha(x)
12: FUN(X[[i]], ...)
11: vapply(remote, function(x) remote_sha(x), character(1))
10: package_deps(deps, repos = repos, type = type)
9: nrow(cran_deps)
8: combine_deps(package_deps(deps, repos = repos, type = type), 
       remote_deps(pkg, ...))
7: dev_package_deps(pkgdir, repos = repos, dependencies = dependencies, 
       type = type, ...)
6: install_deps(pkgdir, dependencies = dependencies, quiet = quiet, 
       build = build, build_opts = build_opts, upgrade = upgrade, 
       repos = repos, type = type, ...)
5: install(source, dependencies = dependencies, upgrade = upgrade, 
       force = force, quiet = quiet, build = build, build_opts = build_opts, 
       repos = repos, type = type, ...)
4: FUN(X[[i]], ...)
3: vapply(remotes, install_remote, ..., FUN.VALUE = character(1))
2: install_remotes(remotes, auth_token = auth_token, host = host, 
       dependencies = dependencies, upgrade = upgrade, force = force, 
       quiet = quiet, build = build, build_opts = build_opts, repos = repos, 
       type = type, ...)
1: remotes::install_github("foo",  auth_token = token2, force = TRUE)

Metadata

Metadata

Assignees

No one assigned

    Labels

    featurea feature request or enhancementgithub

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions