Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

R 3.6.0 - Fatal error with .Rprofile #4723

Closed
DavisVaughan opened this issue Apr 29, 2019 · 11 comments · Fixed by #4726
Closed

R 3.6.0 - Fatal error with .Rprofile #4723

DavisVaughan opened this issue Apr 29, 2019 · 11 comments · Fixed by #4726
Assignees
Labels
Milestone

Comments

@DavisVaughan
Copy link

@DavisVaughan DavisVaughan commented Apr 29, 2019

System details

RStudio Edition : Desktop
RStudio Version : 1.2.1330
OS Version      : Mac OS
R Version       : 3.6.0

Steps to reproduce the problem

Place the following in your .Rprofile with usethis::edit_r_profile():

if(interactive()) {
  library(prompt)

  set_prompt(function(...){
    paste0(
      "[", git_branch(), "]> "
    )
  })
}

then restart RStudio.

Describe the problem in detail

Immediately upon opening, I get this screen:

Screen Shot 2019-04-29 at 9 03 43 AM

Screen Shot 2019-04-29 at 9 04 29 AM

I think the key here is Error: option error has NULL value

This shows up in other places as well, like knitr. I don't have an easily reproduce example for that quite yet, but you can see this twitter thread for a few complaints: https://twitter.com/romain_francois/status/1122782045653164034

Also cc @romainfrancois since it happened to him too.

@DavisVaughan DavisVaughan changed the title R 3.6.0 - Fatal error with .Rprofile and knitr R 3.6.0 - Fatal error with .Rprofile Apr 29, 2019
@DavisVaughan
Copy link
Author

@DavisVaughan DavisVaughan commented Apr 29, 2019

@DavisVaughan
Copy link
Author

@DavisVaughan DavisVaughan commented Apr 29, 2019

You can also trigger this with an .Rprofile of:

if(interactive()) {
  options(error = utils::recover)
}

@romainfrancois
Copy link
Contributor

@romainfrancois romainfrancois commented Apr 29, 2019

Thanks @DavisVaughan for reporting this here. I think you're right and prompt is just an innocent bystander, and options(error=) is the problem. I can reproduce the same problem with options(error = utils::recover) or options(error = rlang::entrace)

@DavisVaughan
Copy link
Author

@DavisVaughan DavisVaughan commented Apr 29, 2019

Ah, I found the commit in R 3.6 that changed things:
wch/r-source@96bf990#diff-178a6fb02209db6ee641b179edce6eff

This seems to suggest that the prompt package and knitr need to be updated to not use a function that can possibly set the error option to NULL, but it also seems like a really restrictive change...

@mjsteinbaugh
Copy link
Contributor

@mjsteinbaugh mjsteinbaugh commented Apr 29, 2019

+1 that I'm seeing this error pop up with my .Rprofile.
I can confirm that options(error =) is the issue on my system.

@jmcphers
Copy link
Member

@jmcphers jmcphers commented Apr 29, 2019

A temporary workaround is to set rstudio.errors.suppressed to FALSE in your .Rprofile as well.

@Lornebradia
Copy link

@Lornebradia Lornebradia commented May 14, 2019

I am still getting this error.

Essentially, running the default rmarkdown document with the following chunk:

knitr::opts_chunk$set(echo = TRUE)

will lead RStudio to crash, printing repeatedly on the console the error message:

Error: option error has NULL value
Error: option error has NULL value
Error: option error has NULL value
Error: option error has NULL value

(repeat ad nauseam)

So, my google fu returned this issue, which is similar to mine. At least, if I set options(error = utils::recover as suggested above, I get the same issue.

The solution offered above, that a line options(error = ) is causing trouble on .Rprofile, and deleting that line fixes the problem, doesn't really help me, as my .Rprofile is empty, I don't have one in my project, nor in my home directory, nor in R HOME. So I can't delete what doesn't exist.

If I add a line with some error handling option sure thing, I get the same error as referenced in the GitHub issue. Not very helpful.

The solution suggested,

A temporary workaround is to set  rstudio.errors.suppressed  to  FALSE  in your  .Rprofile  as well.

doesn't work for me either, unless this involves something different than a line like

options(rstudio.errors.suppressed = FALSE)

on .Rprofile.

So I am at a loss on what to do, other than revert to R 3.5.3 and wait for patch 3.6.1.

─ Session info ─────────────────────────────────────────────────────────────────────────────────────────
 setting  value                       
 version  R version 3.6.0 (2019-04-26)
 os       macOS Sierra 10.12.6        
 system   x86_64, darwin15.6.0        
 ui       RStudio                     
 language (EN)                        
 collate  en_US.UTF-8                 
 ctype    en_US.UTF-8                 
 tz       Europe/Warsaw               
 date     2019-05-14                  

─ Packages ─────────────────────────────────────────────────────────────────────────────────────────────
 package     * version date       lib source        
 assertthat    0.2.1   2019-03-21 [1] CRAN (R 3.6.0)
 cli           1.1.0   2019-03-19 [1] CRAN (R 3.6.0)
 crayon        1.3.4   2017-09-16 [1] CRAN (R 3.6.0)
 rstudioapi    0.10    2019-03-19 [1] CRAN (R 3.6.0)
 sessioninfo   1.1.1   2018-11-05 [1] CRAN (R 3.6.0)
 withr         2.1.2   2018-03-15 [1] CRAN (R 3.6.0)

@ronblum
Copy link
Contributor

@ronblum ronblum commented Jun 3, 2019

Verified in RStudio Desktop 1.2.1522 on MacOS 10.14.6 with R 3.6.0.

@Lornebradia The symptoms you're describing look like issue #4759. If you're still experiencing the problem, can you please include the information in that ticket, along with the version of RStudio you're using. Thanks!

@Ayeshasaeedhaq
Copy link

@Ayeshasaeedhaq Ayeshasaeedhaq commented Feb 12, 2020

I tried the very first fix. usethis::edit_r_profile()

if(interactive()) {
  library(prompt)
  
  set_prompt(function(...){
    paste0(
      "[", git_branch(), "]> "
    )
  })
}

and got the following error: Error in library(prompt) : there is no package called ‘prompt’

@mgagliol
Copy link

@mgagliol mgagliol commented Feb 26, 2021

@Ayeshasaeedhaq you need to install the library first with install.packages("prompt")

@Ayeshasaeedhaq
Copy link

@Ayeshasaeedhaq Ayeshasaeedhaq commented Feb 26, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants