QuartzBitmap_Output error prevents running individual R Chunks

Hi, I am trying to run a very simple Quarto document, cell by cell, using the visual editor. Something is going wrong with how R saves its plots that prevents me from running additonal cells.

I created an Rproject in a folder on my hard drive (running MacOS Sonoma 14.6.1). Within that project, I created a Quarto document and saved it. I load ggplot2 and create a plot successfully.

{r}
library(ggplot2)
ggplot(cars, aes(x =speed, y=dist )) + geom_point()

If I make a mistake, say, ggplot(cars, aes(x =speed, y=mistake )) + geom_point() I get this error, as expected:

Error in `geom_point()`:
! Problem while computing aesthetics.
ℹ Error occurred in the 1st layer.
[...more messages...]
 16. rlang (local) FUN(X[[i]], ...)

If I fix the error, or move on to a new cell, all is well. However, after a few minutes, with the exact same code (and same mistake), the console will return this message appended to the normal error message:

Error in dev.off() : 
  QuartzBitmap_Output - unable to open file '/Users/mds/test_quarto/.Rproj.user/shared/notebooks/18E8589E-test3/1/CB1B30DC218300bf/cidwre0mi6mw6_t/_rs_chunk_plot_001.png'

Once this appears, R is dead in the water. Any other cell I try to run will display the "busy" clock, and I can't run anything until I restart R (though I can still render the PDF, strangely).

I cannot seem to reproduce this error simply by running the exact same code—it seems to be depend on how much time has passed since I last restarted R. I'm guessing, therefore, it has something do with Rstudio talking to my hard drive. At first I though it was a Dropbox sync issue but creating a new project outside of Dropbox in the root directory has not helped.

What's going on and what can I do about it? I'm running the latest release of RStudio and R. This has been going on for several months.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.