EnquistLab/RTNRS

Repeated HTTP 400 errors

Closed this issue · 5 comments

Hello! I have been trying to run TNRS on a couple of species lists, but keep getting the error message:

Problem with the API: HTTP Status 400

I've tried this on multiple species lists, computers and internet connections and get the same error each time. Pasting the same species lists into https://tnrs.biendata.org/ seems to work fine, so I'm guessing something is up with the R API?

R session info in case that helps:

R version 4.3.0 (2023-04-21)
Platform: x86_64-apple-darwin20 (64-bit)
Running under: macOS Monterey 12.6.7

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: Australia/Sydney
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] phytools_1.5-1      maps_3.4.1          phylolm_2.6.2      
 [4] V.PhyloMaker2_0.1.0 ape_5.7-1           TNRS_0.3.4         
 [7] rtry_1.0.0          ggpubr_0.6.0        lubridate_1.9.2    
[10] forcats_1.0.0       stringr_1.5.0       dplyr_1.1.2        
[13] purrr_1.0.1         readr_2.1.4         tidyr_1.3.0        
[16] tibble_3.2.1        ggplot2_3.4.2       tidyverse_2.0.0    

loaded via a namespace (and not attached):
 [1] tidyselect_1.2.0        optimParallel_1.0-2     combinat_0.0-8         
 [4] digest_0.6.32           timechange_0.2.0        lifecycle_1.0.3        
 [7] magrittr_2.0.3          compiler_4.3.0          rlang_1.1.1            
[10] tools_4.3.0             igraph_1.5.0            plotrix_3.8-2          
[13] utf8_1.2.3              ggsignif_0.6.4          phangorn_2.11.1        
[16] clusterGeneration_1.3.7 curl_5.0.1              bit_4.0.5              
[19] mnormt_2.1.1            scatterplot3d_0.3-44    pkgload_1.3.2          
[22] abind_1.4-5             expm_0.999-7            withr_2.5.0            
[25] numDeriv_2016.8-1.1     grid_4.3.0              fansi_1.0.4            
[28] colorspace_2.1-0        future_1.33.0           globals_0.16.2         
[31] scales_1.2.1            iterators_1.0.14        MASS_7.3-60            
[34] cli_3.6.1               crayon_1.5.2            generics_0.1.3         
[37] rstudioapi_0.14         future.apply_1.11.0     httr_1.4.6             
[40] tzdb_0.4.0              readxl_1.4.2            parallel_4.3.0         
[43] cellranger_1.1.0        vctrs_0.6.3             Matrix_1.5-4.1         
[46] jsonlite_1.8.7          carData_3.0-5           car_3.1-2              
[49] hms_1.1.3               bit64_4.0.5             rstatix_0.7.2          
[52] listenv_0.9.0           foreach_1.5.2           glue_1.6.2             
[55] parallelly_1.36.0       codetools_0.2-19        stringi_1.7.12         
[58] gtable_0.3.3            quadprog_1.5-8          munsell_0.5.0          
[61] pillar_1.9.0            R6_2.5.1                doParallel_1.0.17      
[64] vroom_1.6.3             lattice_0.21-8          backports_1.4.1        
[67] broom_1.0.5             Rcpp_1.0.10             fastmatch_1.1-3        
[70] coda_0.19-4             nlme_3.1-162            pkgconfig_2.0.3

Hi Ruby! Thanks so much for letting us know! I've tried submitting a few batches of species and haven't been able to replicate this issue yet. Can you email me (bmaitner@gmail.com) one of the species lists that was causing problems so I can try running that locally and try to replicate things?

Hi Brian!

Thanks for looking into this. I tested it out again before sending the species lists and have figured out the problem - the data frames I was passing into the TNRS function had just one column of species names, not the recommended two columns with one containing row numbers and the other the species names.

Would it be possible to add to the TNRS function an early validation that the data being passed are in the necessary format, and return an error message to reformat data if not?

I've now run it passing it just the species names as a character vector (i.e. TNRS(df$species_names)) and it works as expected, although curiously it returns slightly different match results to pasting into the website. Shall close this issue, thanks for your help!

Glad to hear you've figured it out! And thanks, that's an excellent suggestion, I'll add a new issue :)

Hi Ruby and Brian,

I'm running into this same issue. I'm using code that previously ran successfully (inputting a dataframe with the two suggested columns), and then I also tried submitting just a character vector of names - both attempts are giving me the same result that Ruby mentioned before: "Problem with the API: HTTP Status 400".

I can provide the list of species names I'm using, if that would be helpful. Thanks in advance!

Whoops! Looks like I was running an old version of the TNRS package. I updated to the most recent version and that fixed it. I probably should've checked that before commenting here :)