available icon indicating copy to clipboard operation
available copied to clipboard

`available::available()` fails to return any results due to Error 502

Open adamhsparks opened this issue 6 months ago • 6 comments

This occurs with both the CRAN and development version from this repository.

If prompted for GitHub credentials, enter your PAT in the password field
Using GITHUB_PAT from Adam H. Sparks (credential helper: /usr/local/bin/git-credential-manager)
> available::available("isitwet")
Error in open.connection(con, "rb") : 
  cannot open the connection to 'http://rpkg-api.gepuro.net/rpkg?q=isitwet'
In addition: Warning message:
In open.connection(con, "rb") :
  cannot open URL 'http://rpkg-api.gepuro.net/rpkg?q=isitwet': HTTP status was '502 Bad Gateway'

adamhsparks avatar May 13 '25 04:05 adamhsparks

I suggest you use pak::pkg_name_check() instead of available::available():

❯ pak::pkg_name_check("isitwet")
╔══════════════════════════════════════════════════════════════════════════════╗
║                                –*– isitwet –*–                               ║
╚══════════════════════════════════════════════════════════════════════════════╝
┌──────────────────────────────────────────────────────────────────────────────┐
│ ✔  valid name      ✔  CRAN            ✔  Bioconductor    ✔  not a profanity  │
└──────────────────────────────────────────────────────────────────────────────┘
┌ Wikipedia ───────────────────────────────────────────────────────────────────┐
│ Isitwet No definition found                                                  │
└────────────────────────────────────────────────────────────────────────────  ┘
┌ Wiktionary ──────────────────────────────────────────────────────────────────┐
│ isitwet No English definition found                                          │
└────────────────────────────────────────────────────────────────────────────  ┘
┌──────────────────────────────────────────────────────────────────────────────┐
│ Sentiment: 😐 (0)                                                            │
└──────────────────────────────────────────────────────────────────────────────┘

gaborcsardi avatar May 13 '25 06:05 gaborcsardi

I found this issue after hitting the same problem in {available}. However, I'm getting this with the alternative you kindly suggested @gaborcsardi :

> pak::pkg_name_check("isitwet")
Error: 
! error in pak subprocess
Caused by error in `strsplit(x, as.character(split), fixed, perl, useBytes)`:
! NA in coercion to boolean
Type .Last.error to see the more details.

> .Last.error
<callr_error/rlib_error_3_0/rlib_error/error>
Error: 
! error in pak subprocess
Caused by error in `strsplit(x, as.character(split), fixed, perl, useBytes)`:
! NA in coercion to boolean
---
Backtrace:
1. pak::pkg_name_check("isitwet")
2. pak:::remote(function(...) { …
3. err$throw(res$error)
---
Subprocess backtrace:
 1. base::withCallingHandlers(cli_message = function(msg) { …
 2. asNamespace("pak")$pak_preformat(ret)
 3. base::format(x, ...)
 4. pkgdepends:::format.pkg_name_check(x, ...)
 5. base::unlist(lapply(x, format, limit = limit, ...))
 6. base::lapply(x, format, limit = limit, ...)
 7. base::FUN(X[[i]], ...)
 8. pkgdepends:::format.pkg_name_check_wiktionary(X[[i]], ...)
 9. base::paste(cli::style_underline(x$term), clean_wiktionary_text(x$text))
10. pkgdepends:::clean_wiktionary_text(x$text)
11. base::strsplit(x, "\n== ", x)
12. base::.handleSimpleError(function (e) …
13. global h(simpleError(msg, call))

Is this something I should be reporting as an issue on the {pak} repo? Or maybe I've missed something here?

louisaslett avatar May 16 '25 16:05 louisaslett

@louisaslett With what version of pak and R? On what platform? How did you install pak?

gaborcsardi avatar May 17 '25 12:05 gaborcsardi

Sorry, should have added that originally ...

> R.version.string
[1] "R version 4.5.0 (2025-04-11)"

> Sys.info()[1:3]
                                                                                                 sysname 
                                                                                                "Darwin" 
                                                                                                 release 
                                                                                                "24.5.0" 
                                                                                                 version 
"Darwin Kernel Version 24.5.0: Tue Apr 22 19:48:46 PDT 2025; root:xnu-11417.121.6~2/RELEASE_ARM64_T8103" 

> install.packages("pak")
trying URL 'https://www.stats.bris.ac.uk/R/bin/macosx/big-sur-arm64/contrib/4.5/pak_0.8.0.2.tgz'
Content type 'application/x-gzip' length 5449716 bytes (5.2 MB)
==================================================
downloaded 5.2 MB


The downloaded binary packages are in
	/var/folders/k6/z22yq8p57670bz0r4xnhj5300000gn/T//RtmpmCjc9o/downloaded_packages

> pak::pkg_name_check("isitwet")
Error: 
! error in pak subprocess
Caused by error in `strsplit(x, as.character(split), fixed, perl, useBytes)`:
! NA in coercion to boolean
Type .Last.error to see the more details.

louisaslett avatar May 17 '25 13:05 louisaslett

Seems to be fixed in the dev version, you can install it like this:

install.packages("pak", repos = sprintf(
  "https://r-lib.github.io/p/pak/devel/%s/%s/%s",
  .Platform$pkgType,
  R.Version()$os,
  R.Version()$arch
))

https://pak.r-lib.org/reference/install.html#nightly-builds

gaborcsardi avatar May 18 '25 11:05 gaborcsardi

Thanks, confirming dev version of {pak} works for that function my end too.

louisaslett avatar May 18 '25 12:05 louisaslett