pkg <- file.path(tempdir(), "pkglength")
dir.create(file.path(pkg, "R"), recursive = TRUE, showWarnings = FALSE)
writeLines(c(
"Package: pkglength",
"Title: Minimal Package That Exports length()",
"Version: 0.0.1",
"Authors@R: person('A', 'B', email = 'a@b.com', role = c('aut', 'cre'))",
"Description: Reproduces a pkgdown build failure.",
"License: MIT + file LICENSE",
"Encoding: UTF-8"
), file.path(pkg, "DESCRIPTION"))
writeLines(c("YEAR: 2026", "COPYRIGHT HOLDER: A B"), file.path(pkg, "LICENSE"))
writeLines("export(length)", file.path(pkg, "NAMESPACE"))
writeLines(c(
"#' A length() stub",
"#' @param x Ignored.",
"#' @return Never returns.",
"#' @name length",
"#' @export",
"length <- function(x) stop('pkglength::length() is not meant to be called')"
), file.path(pkg, "R", "length.R"))
# a man page so as_pkgdown() has a topic to parse
dir.create(file.path(pkg, "man"))
writeLines(c(
"\\name{length}", "\\alias{length}", "\\title{A length() stub}",
"\\usage{length(x)}", "\\arguments{\\item{x}{Ignored.}}",
"\\description{A length() stub.}"
), file.path(pkg, "man", "length.Rd"))
lib <- file.path(tempdir(), "lib")
dir.create(lib, showWarnings = FALSE)
install.packages(pkg, repos = NULL, type = "source", lib = lib)
withr::with_libpaths(lib, action = "prefix", {
# Real-world entry point (this is what users hit):
pkgdown::build_site(pkg, new_process = FALSE, install = FALSE)
})
#> ── Initialising site ───────────────────────────────────────────────────────────
#> Copying <pkgdown>/BS3/assets/bootstrap-toc.css to bootstrap-toc.css
#> Copying <pkgdown>/BS3/assets/bootstrap-toc.js to bootstrap-toc.js
#> Copying <pkgdown>/BS3/assets/docsearch.css to docsearch.css
#> Copying <pkgdown>/BS3/assets/docsearch.js to docsearch.js
#> Copying <pkgdown>/BS3/assets/link.svg to link.svg
#> Copying <pkgdown>/BS3/assets/pkgdown.css to pkgdown.css
#> Copying <pkgdown>/BS3/assets/pkgdown.js to pkgdown.js
#> ── Building pkgdown site for package pkglength ─────────────────────────────────
#>
#> Reading from:
#> /var/folders/dj/yhk9rkx97wn_ykqtnmk18xvc0000gn/T/RtmpIh9aw1/pkglength
#> Writing to:
#> /var/folders/dj/yhk9rkx97wn_ykqtnmk18xvc0000gn/T/RtmpIh9aw1/pkglength/docs
#> ── Sitrep ──────────────────────────────────────────────────────────────────────
#>
#> ✖ Bootstrap 3 is deprecated; please switch to Bootstrap 5.
#> ℹ Learn more at
#> <https://www.tidyverse.org/blog/2021/12/pkgdown-2-0-0/#bootstrap-5>.
#> ✖ URLs not ok.
#> No '_pkgdown.yml' found.
#> See details in `vignette(pkgdown::metadata)`.
#> ✔ Favicons ok.
#> ✔ Open graph metadata ok.
#> ✔ Articles metadata ok.
#> ✔ Reference metadata ok.
#> ── Initialising site ───────────────────────────────────────────────────────────
#>
#> ── Building home ───────────────────────────────────────────────────────────────
#>
#> Writing `authors.html`
#> Writing `LICENSE-text.html`
#> Reading 'DESCRIPTION'
#> Writing `index.html`
#> Writing `404.html`
#> ── Building function reference ─────────────────────────────────────────────────
#>
#> Writing `reference/index.html`
#>
#> Attaching package: 'pkglength'
#>
#>
#> The following object is masked from 'package:base':
#>
#> length
#>
#>
#> Reading man/length.Rd
#> Error in `length()`:
#> ! pkglength::length() is not meant to be called
rlang::last_trace()
#> <error/rlang_error>
#> Error in `length()`:
#> ! pkglength::length() is not meant to be called
#> ---
#> Backtrace:
#> ▆
#> 1. ├─withr::with_libpaths(...)
#> 2. │ └─base::force(code)
#> 3. ├─pkgdown::build_site(pkg, new_process = FALSE, install = FALSE)
#> 4. │ └─pkgdown:::build_site_local(...)
#> 5. │ └─pkgdown::build_reference(...)
#> 6. │ ├─pkgdown:::unwrap_purrr_error(...)
#> 7. │ │ └─base::withCallingHandlers(...)
#> 8. │ └─purrr::map(...)
#> 9. │ └─purrr:::map_("list", .x, .f, ..., .progress = .progress)
#> 10. │ ├─purrr:::with_indexed_errors(...)
#> 11. │ │ └─base::withCallingHandlers(...)
#> 12. │ ├─purrr:::call_with_cleanup(...)
#> 13. │ └─pkgdown (local) .f(.x[[i]], ...)
#> 14. │ └─pkgdown::render_page(...)
#> 15. │ └─pkgdown:::render_page_html(pkg, name = name, data = data, depth = depth)
#> 16. │ ├─pkgdown:::modify_list(data_template(pkg, depth = depth), data)
#> 17. │ └─pkgdown::data_template(pkg, depth = depth)
#> 18. │ └─pkgdown:::data_navbar(pkg, depth = depth)
#> 19. │ └─pkgdown:::navbar_links(pkg, depth = depth, call = call)
#> 20. │ └─pkgdown:::navbar_link_components(pkg, call = call)
#> 21. │ ├─base::intersect(...)
#> 22. │ └─pkgdown:::config_pluck_character(...)
#> 23. │ └─pkgdown:::config_pluck(pkg, path, default)
#> 24. │ └─purrr::pluck(pkg$meta, !!!where, .default = default)
#> 25. │ └─purrr:::pluck_raw(.x, list2(...), .default = .default)
#> 26. ├─pkglength::length(`<prnt_yml>`)
#> 27. │ └─base::stop("pkglength::length() is not meant to be called") at pkglength/R/length.R:6:11
#> 28. ├─base::.handleSimpleError(...)
#> 29. │ └─purrr (local) h(simpleError(msg, call))
#> 30. │ └─cli::cli_abort(...)
#> 31. │ └─rlang::abort(...)
#> 32. │ └─rlang:::signal_abort(cnd, .file)
#> 33. │ └─base::signalCondition(cnd)
#> 34. └─pkgdown (local) `<fn>`(`<prrr_rr_>`)
#> 35. └─rlang::cnd_signal(err$parent)
#> 36. └─rlang:::signal_abort(cnd)
Real-world usage: https://github.com/cynkra/dd . I really wonder what's happening under the hood.
Created on 2026-07-24 with reprex v2.1.1