.onLoad failed when loading packages: how to troubleshoot?

First, apologies for the pictures. I have no clue on how to make this a reproducible example.

Last night a job was interrupted by a loss of internet connection.


Since then for some reason packages won't load normally using library.

  1. In some R sessions packages load normally, code execution runs fine.

  2. When I open another instance, it will throw a bunch errors that differ each time library is called

  3. Other times it prints *** recursive gc invocation before failing, often terminating the R session.

  4. However, sometimes the 2nd library call runs just fine... :face_with_raised_eyebrow:

What I've done so far:

  • Reinstall the package devtools

  • Update R to 4.1.1, clean install of all packages

  • Deleted any .RData files I could find

  • Disable virus protection - issue persists

  • Run commands in R without RStudio IDE - working normally

  • Read diagnostics

2021-10-17T08:53:18.414216Z [rsession-D] ERROR evaluateExpression called from thread other than main; LOGGED FROM: class rstudio::core::Error __cdecl rstudio::r::exec::anonymous-namespace'::evaluateExpressionsUnsafe(struct SEXPREC *,struct SEXPREC *,struct SEXPREC **,class rstudio::r::sexp::Protect *,enum rstudio::r::exec::anonymous-namespace'::EvalType) src/cpp/r/RExec.cpp:140
2021-10-17T08:53:18.618227Z [rsession-D] ERROR R.getOption: rstudio.errors.suppressed made from non-main thread; LOGGED FROM: struct SEXPREC *__cdecl rstudio::r::options::getOption(const class std::basic_string<char,struct std::char_traits,class std::allocator > &) src/cpp/r/ROptions.cpp:83
2021-10-17T09:00:49.635414Z [rsession-D] WARNING findProgramOnPath returns wrong result: C:\Users\D\AppData\Roaming\TinyTeX\bin\win32\pdflatex.exe != C:/Users/D/AppData/Roaming/TinyTeX/bin/win32/pdflatex.exe; LOGGED FROM: class rstudio::core::FilePath __cdecl rstudio::session::module_context::findProgram(const class std::basic_string<char,struct std::char_traits,class std::allocator > &) src/cpp/session/SessionModuleContext.cpp:1206
2021-10-17T09:00:51.350464Z [rsession-D] ERROR CLIENT EXCEPTION (rsession-D): (TypeError) : Cannot read property 'M' of null;|||org/rstudio/studio/client/workbench/views/source/editors/text/AceEditor.java#4487::setScrollSpeed|||org/rstudio/studio/client/workbench/views/source/editors/text/AceEditorMonitor.java#46::monitor|||org/rstudio/studio/client/workbench/views/source/editors/text/AceEditorMonitor.java#70::execute|||com/google/gwt/core/client/impl/SchedulerImpl.java#140::execute|||com/google/gwt/core/client/impl/Impl.java#306::apply|||com/google/gwt/core/client/impl/Impl.java#345::entry0|||rstudio-0.js#-1::eval|||com/google/gwt/cell/client/AbstractEditableCell.java#41::viewDataMap|||Client-ID: 33e600bb-c1b1-46bf-b562-ab5cba070b0e|||User-Agent: Mozilla/5.0 (Windows NT 10.0 Win64 x64) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.12.8 Chrome/69.0.3497.128 Safari/537.36


Any tips on how to proceed troubleshooting this issue?

1 Like

about 100 library(tidyverse)'s later it seems the following has solved the issue:

  1. Tools > Global Options > untick "Restore most recently opened project at startup" and "Restore previously open source documents at startup". Click Apply

  2. Clear projects list (file menu > clear projects list)

1 Like

This topic was automatically closed 21 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.