Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Phantom RStudio Errors

I'm encountering some really odd behavior with rstudio version 1.0.136 and r version 3.3.2, which unfortunately does not lend itself to a reproducible example.

Whenever I force quit an rstudio project, I start getting these weird phantom error messages as thought rstudio is trying to run code which is not longer present in the project. This happens whenever I type anything in a saved script in the editor.

Does anyone have any thoughts about how I might identify the root cause of this error? Or alternately how I could completely delete everything rstudio knows about the pre-crash project?

Updates

It is somewhat code independent and has happened on a few projects. I don't actually see the code which it is trying to run, but only the error message which results, which is typically trying to load a file which doesn't exist, or calling a function which hasn't been loaded into memory. I tried the following things:

  • Deleting the .rproj file and starting a new project in the same folder (no change)
  • Reinstalling R (no change)
  • Reinstalling RStudio (no change)
  • Upgrading to Sierra (no change)
  • Moving all files in a project to a new project in a new folder (problem solved, but re-occurs if there is a subsequent force-quit)
  • Switching from a saved file to a new untitled file (problem solved, but re-occurs when new file is saved)
  • Turning off "Restore previously open source documents at startup" (This seemed to have solved the problem at one point, but then it returned. So not a fix)
  • Deleted RStudio and Rstudio desktop directory according to these instructions: https://support.rstudio.com/hc/en-us/articles/200554736-How-To-Uninstall-RStudio then reinstalling (Did not fix)
  • Currently, when I run a script in a saved script it crashes RStudio, when I run it in an untitled file it works. Similarly when I run it in a base R console it works.

So I think what's going on is that when RStudio quits unexpectedly, there's some reference to the initial file which is loaded by the loading R files at startup.

Edit

Related errors: https://support.rstudio.com/hc/en-us/community/posts/220481907-Phantom-error-messages-on-RStudio

like image 425
Shorpy Avatar asked Sep 01 '25 22:09

Shorpy


1 Answers

Based on your description of the problem it seems that Rstudio is trying to run a code that does not exist or depends on packages that are no longer installed. But if the errors only happen when you start typing, it might be due to code diagnostics that runs in the background which is triggered as you type.

try to navigate to tools -> global options -> code -> diagnostics and uncheck the following:

  • Show diagnostics for R
  • Show diagnostics whenever source files are saved
  • Show diagnostics after keyboard is idle for a period of time

Inrstudion 1.3 and newer, you can further set the background_diagnostics false by modifying the rstudio-prefs.json file. It can be found in AppData/Roaming/RStudio on Windows and ~/.config/rstudio on other systems.

like image 154
Hussain Alsalman Avatar answered Sep 03 '25 10:09

Hussain Alsalman