Closed fwimp closed 2 months ago
Agree we should surface this error (and wondering what other similar errors we are not surfacing) but I'm not sure how to do that when the call is wrapped in callr::r()
so @hadley may need to weigh in.
Hmmmm, when I add that vignette to pkgdown and call build_site()
, I (eventually) see:
Error:
! ! in callr subprocess.
Caused by error in `.f(.x[[i]], ...)`:
! Failed to render vignettes/problem.Rmd.
Caused by error:
! Duplicate chunk label 'label', which has been used for the chunk:
NULL
Show Traceback
Hmm that's strange.
I am on R version 4.3.0 Current pkgdown (2.1.1) dependencies on my end are | package | pkgdown min | installed | latest |
---|---|---|---|---|
bslib | ≥0.5.1 | 0.6.0 | 0.8.0 | |
callr | ≥ 3.7.3 | 3.7.3 | 3.7.6 | |
cli | ≥ 3.6.1 | 3.6.3 | - | |
desc | ≥ 1.4.0 | 1.4.2 | 1.4.3 | |
digest | - | 0.6.33 | 0.6.37 | |
downlit | ≥ 0.4.4 | 0.4.4 | - | |
fontawesome | - | 0.5.2 | - | |
fs | - | 1.6.3 | 1.6.4 | |
httr2 | ≥ 1.0.2 | 1.0.3 | 1.0.4 | |
jsonlite | - | 1.8.8 | 1.8.9 | |
openssl | - | 2.2.0 | 2.2.2 | |
purrr | ≥ 1.0.0 | 1.0.2 | - | |
ragg | - | 1.2.6 | 1.3.3 | |
rlang | ≥ 1.1.0 | 1.1.2 | 1.1.4 | |
rmarkdown | ≥ 2.27 | 2.27 | 2.28 | |
tibble | - | 3.2.1 | - | |
whisker | - | 0.4.1 | - | |
withr | ≥ 2.4.3 | 2.5.2 | 3.0.1 | |
xml2 | ≥ 1.3.1 | 1.3.5 | 1.3.6 | |
yaml | - | 2.3.8 | 2.3.10 |
If the issue is rooted in an "outdated" version of one of those, that implies that potentially a bump in the required version of the package at fault would fix it.
Just looking at the options alongside the stack trace and source code for wrap_rmarkdown_error()
in build-article.R, I'm suspicious that if a package version is to blame it's either callr
or rlang
(as the other outdated packages don't seem to be called when handling this error).
I can push my latest package version to its repo (https://github.com/fwimp/ohvbd/) and provide instructions here on how to reproduce the exact issue as I originally discovered it (by renaming a chunk in a vignette), just in case the issue stems somehow from my particular package (though I'm not doing anything particularly obscure with my vignettes).
Would that be helpful?
Right, I've confirmed that updating rlang to v1.1.4 causes the error to appropriately be propagated up to the user:
Error:
! in callr subprocess.
Caused by error in `.f(.x[[i]], ...)`:
! Failed to render vignettes/duplicate-chunk.Rmd.
Caused by error:
! Duplicate chunk label 'label', which has been used for the chunk:
NULL
ℹ See `$stdout` and `$stderr` for standard output and error.
Type .Last.error to see the more details.
I expect this was fixed in this commit https://github.com/r-lib/rlang/commit/84deb877d1ce4ba50fbaafea246c1eb918805631, as I can't see anything else in the commits making up 1.1.3 and 1.1.4 for rlang that would potentially intersect with this issue. Doesn't really matter in any case as it seems like updating rlang solves the problem.
I guess if this is something that shouldn't happen for users, then bumping the version requirement for pkgdown to rlang ≥1.1.4
should mean that others don't hit this particular frustration. I'm afraid I didn't test through 1.1.3 so it could be that it gets fixed there, in which case the dependency could be relaxed to be rlang ≥1.1.3
.
Yeah, we should just bump the required rlang version just to make sure that no one else experiences this. Thanks for the investigation!
When trying to build a vignette that contains duplicate chunk labels,
build_site()
does not give any real indication of where the problem originated.The full
.Last.error
There is also nothing in
.Last.error$stdout
or.Last.error$stderr
to indicate where this might be going wrong.The data that is required is however present in
.Last.error$parent$parent$message
Whilst not essential, including this data in the error output would make it much easier to track down these sorts of bugs in situations where the vignette is hard to get to knit standalone.
Reprex vignette file