1

I am working on building an R package in RStudio. I am using R version 4.5.0 and RStudio version 2024.12.1 Build 563 on Ubuntu 24.04.2 LTS. When I install my package from the "install" button (which should run R CMD INSTALL --preclean --no-multiarch --with-keep.source<pkg>) in RStudio, I am intermittently getting a lazy-load database error and a warning message about the package being corrupt. This happens when I hit "install" when the package is loaded and data generated by the package is loaded. With a fresh R instance, it doesn't occur.

Error: lazy-load database '/home/user/R/x86_64-pc-linux-gnu-library/4.5/mypackage/R/mypackage.rdb' is corrupt
In addition: Warning message:
internal error 1 in R_decompress1 with libdeflate 

I can fix it by running .rs.restartR(), and my package runs as expected, but I would prefer to find the root cause and fix it. I checked to see if I can recreate the error with packages from CRAN as well as a package that has passed CRAN checks that I developed previously, and I cannot recreate the error in either of these packages.

4
  • RStudio has a lot of bugs lately. You should report this to Posit. Commented Apr 22 at 8:44
  • 6
    I get that kind of error all the time: when you install a package into R that is currently attached (e.g., via library() or similar function), R caches some things about the package. When the meta files of the package (.rdb, etc) change because you install it again, the file is changed underneath and R's recall of the file (indexing, etc) changes, it complains like this. I've seen this for ... a long time, and I've never found nor seen a way to work around it other than restarting R. It is frustrating. (And it is not related to the RStudio IDE.) Commented Apr 22 at 9:20
  • Thank you very much; I hadn't noticed this warning/error before upgrading R and RStudio recently, but from the comments here it sounds like a correlation != causation situation rather than something else going on. Commented Apr 23 at 5:38
  • I can confirm what r2evans is saying, it's super annoying. You can see some mentions on Rmailing list, yihui was complaining about it before. Ben Bolker linked previously reported issues here: github.com/lme4/lme4/issues/407#issuecomment-645692691. Normally, restarting session works, but that is annoying when you are developing pkgs. Commented Oct 21 at 22:11

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.