Error: processing vignette 'indirect.Rmd' failed with diagnostics: invalid 'path' argument

It seems that one of my vignette is failing to build on GitHub actions, but only on Windows and macOS, and although it runs with no error/warning/note with R CMD check locally on Windows 10.

The vignette can be accessed here: Automatic indirect effects • lavaanExtra (and it's GitHub code here: lavaanExtra/indirect.Rmd at main · rempsyc/lavaanExtra · GitHub). The failed run can be accessed here: lavaanExtra 0.0.8 · rempsyc/lavaanExtra@8f7309b · GitHub

And the full message is the following:

Quitting from lines 23-48 (indirect.Rmd)

Error: Error: processing vignette 'indirect.Rmd' failed with diagnostics:
invalid 'path' argument

Error: Error: Vignette re-building failed.
Error: Error in proc$get_built_file() : Build process failed
Warning: No files were found with the provided path: check. No artifacts will be uploaded.

The lines mentioned are the first code chunk where I do actual processing (first one just loads functions), and there is a plot being printed; I suspect the problem might relate to this as it is when I added this plotting function that the problem started appearing.

The strange thing is that I don't deal with paths in this vignette or in the functions used. I have checked online for this message but have not found any satisfying answer. Any idea?

I don't get the error locally either, I'd recommend trying updating the cache-version, just in case this easy fix works. Update R-CMD-check.yaml by maelle · Pull Request #5 · rempsyc/lavaanExtra · GitHub

Try breaking the failing chunk into smaller pieces to see where the failure is coming from.

Try calling tools::buildVignette() directly instead of from R CMD check, maybe you'll get a better error message.

1 Like

Thanks Gabor and Maëlle for helping out on this!

Gabor I have done as you suggested and broke the failing chunks where I expected it to fail, and it did fail at this one simple plotting function:

nice_lavaanPlot(fit)

This function in turn is defined here: lavaanExtra/nice_lavaanPlot.R at main · rempsyc/lavaanExtra · GitHub

But essentially it is a simple wrapper for lavaanPlot::lavaanPlot:

rlang::check_installed(c("lavaanPlot", "DiagrammeRsvg", "rsvg", "png", "webshot"),
                         reason = "for this function.")
  lavaanPlot::lavaanPlot(model = model,
                         node_options = node_options,
                         edge_options = edge_options,
                         coefs = coefs,
                         stand = stand,
                         covs = covs,
                         stars = stars,
                         graph_options = graph_options,
                         sig = sig,
                         ...)

So I copy-pasted just that bit lavaanPlot::lavaanPlot in an earlier chunk, and it is indeed the cause of error. Not sure why though.

As for building the vignette, I normally build them with Ctrl+Shift+K and with the pkgdown site with no issue. I've tried tools::buildVignette("indirect.Rmd") from the package working directory and it couldn't find the file:

Error in tools::buildVignette("indirect.Rmd") : 
  file 'indirect.Rmd' not found

Even after explicitly specifying the directory with the dir argument in different ways (e.g., tools::buildVignette("indirect.Rmd", dir = "vignettes")), etc. So I'm not sure what's going on there, it didn't work with any of my vignettes... Is that how you wanted me to use this, or did you mean in the github workflow somehow?

I also wonder whether it'd be worth comparing the package versions between the GHA runs (and between GHA / your system). On Ubuntu for instance the rlang version is more recent (1.0.5 vs 1.0.4)

Thanks. For reference, I have also opened an issue with the author of the lavaanPlot package, "invalid 'path' argument" error when building lavaanPlot vignette on GitHub actions · Issue #42 · alishinski/lavaanPlot · GitHub

Since a simple test vignette with the default lavaanPlot docs example throws the same error: lavaanExtra/test.Rmd at main · rempsyc/lavaanExtra · GitHub

So, kind of strange that it happens in my github workflow but not others?

What kind of image file is knitr supposed to generate here? Maybe you can set a different graphics device, because the one you are using (possibly the default?) is not working for some reason.

Ok, one thing I noticed is that the lavaanPlot's vignettes use %\VignetteEngine{knitr::rmarkdown} instead of %\VignetteEngine{knitr::knitr}, so I tried changing this, and... there's no errors now, but there's a warning suggesting the vignettes are not built at all:

Warning: Files in the 'vignettes' directory but no files in 'inst/doc':

I also tried VignetteBuilder: rmarkdown (instead of knitr) in my DESCRIPTION file, but that didn't seem to help. I'm not sure what's best practice here, but should I always use VignetteBuilder: knitr like I had?

And what's the difference between %\VignetteEngine{knitr::rmarkdown} and %\VignetteEngine{knitr::knitr}? I've seen both, but the only thing I know is that things usually don't work for my vignettes when I use rmarkdown instead of knitr in there (but thought it should make no difference?). I also had to add all the family to my Suggests early on: knitr, rmarkdown, and also markdown, else I always get errors or warnings.

Ok so because of some mysterious magic, adding back %\VignetteEngine{knitr::rmarkdown} made the GHA run without any error or warnings this last time... Strange!!!! But as long as it works, I am relieved... :sleepy::relieved::hugs:

1 Like