Skip to content

Cryptic error from install_github() if reference doesn't exist  #1204

@jennybc

Description

@jennybc

If you try to install from github ref that doesn't exist, the error message can be pretty odd. Here's an attempt to install from a PR that has been closed and the underlying branch deleted.

devtools::install_github("rstudio/rmarkdown#711")
#> Using GitHub PAT from envvar GITHUB_PAT
#> Using GitHub PAT from envvar GITHUB_PAT
#> Downloading GitHub repo rstudio/rmarkdown@feature/html-vignette-readme
#> from URL https://api.github.com/repos/rstudio/rmarkdown/zipball/feature/html-vignette-readme
#> No encoding supplied: defaulting to UTF-8.
#> Error: lexical error: invalid char in json text.
#>                                        Not Found
#>                      (right here) ------^

I get same message for a tag or SHA or branch that never existed, i.e., devtools::install_github("rstudio/rmarkdown@v5") or devtools::install_github("rstudio/rmarkdown@1234567") of devtools::install_github("rstudio/rmarkdown@nope").

But the error for a PR that never existed is different and is more informative.

devtools::install_github("rstudio/rmarkdown#20000")
#> Using GitHub PAT from envvar GITHUB_PAT
#> condition in stop(github_error(req)): Not Found (404)
#> *

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions