learnr parse error trailing garbage

I'm using a package of learnr tutorials for teaching that I wrote (https://github.com/profandyfield/discovr).

A couple of my students are getting the following error:

Error: parse error: trailing garbage

          ":{},"value":["0.10.1"]}]}]} {"type":"list","attributes":{},

                     (right here) ------^

Execution halted

For one student, the first tutorial (discovr_01) throws this error but the others load fine. For the second student, the second tutorial (discovr_02) throws this error but the others are fine. I can't replicate the error, and because teaching is remote it's hard to delve into their system. The fact they get it from different tutorials suggests to me that it isn't the tutorial RMDs per se that are the problem, but am I wrong with that assumption? Does anyone have any idea what the error is referring to (i.e. what might be causing it) so I can investigate further?

Session info from one of the students:

sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18362)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252  
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

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

loaded via a namespace (and not attached):
 [1] rstudioapi_0.11  knitr_1.30       magrittr_1.5    
 [4] tidyselect_1.1.0 munsell_0.5.0    colorspace_1.4-1
 [7] R6_2.4.1         rlang_0.4.7      dplyr_1.0.2    
[10] tools_4.0.2      grid_4.0.2       gtable_0.3.0    
[13] xfun_0.17        tinytex_0.26     htmltools_0.5.0
[16] ellipsis_0.3.1   yaml_2.2.1       digest_0.6.25  
[19] tibble_3.0.3     lifecycle_0.2.0  crayon_1.3.4    
[22] purrr_0.3.4      ggplot2_3.3.2    vctrs_0.3.4    
[25] glue_1.4.2       evaluate_0.14    rmarkdown_2.3  
[28] compiler_4.0.2   pillar_1.4.6     generics_0.0.2  
[31] scales_1.1.1     renv_0.12.0      pkgconfig_2.0.3

Since the two modules identified both have text input boxes, I'd look for code that parses, especially if using, jsonlite::stream_in. Without error trapping, different students likely will make different errors on different modules. The screenshot shows an example of how malformed input can throw an error

Thanks for your reply, Andy. I am in touch with the support team too. Do you experience the lecture links being disconnected constantly?
Best
Seda

I have met with the same problem with my own learnr tutorial package.

After some investigation, I have fount it might been something wrong with rmarkdown:::shiny_prerendered_prerender(input_rmd, rendered_html, output_dir, prerender_option).

If I delete the so-called rendered_html (such as L04.html) and just keep the input_rmd (such as L04.Rmd) in the package directory inst/tutorial/L04 and re-install the package. After re-installment, press the corresponded Start Tutorial button in RStudio's Tutorial tab, then the error is gone! :grinning:

I hope it helps.

Then it has the โ€œfeelโ€ of an HTML rendering issue. Perhaps caused by impatient refreshing?

Thanks. They're getting the error upon loading the tutorial (and have all recently installed the discovr package so there shouldn't be any lingering memory of the tutorial), so they shouldn't have any text in text boxes. I will check with them though whether they have at any point successfully loaded it and input text ...

1 Like

ohhh, impatient refreshing is a good call ... and easy to check. Thanks for the suggestion.

Hi Andy

I am having the same issue. I'd appreciate if you could share what worked for you please.

thanks
Seda

Hi Seda,
Unfortunately I haven't yet got to the bottom of it. So far it's happened for a tiny number of my students (3-4 out of 500), and not consistently on a particular tutorial, so it's very hard to debug.
andy