Skip to content

setup-renv@v2 can fail during restore when validating a package before a transitive dependency is available #1097

Description

@msaltieri

r-lib/actions/setup-renv@v2 appears to fail in some GitHub Actions environments during renv restore, even though the missing package is present in renv.lock.

What Happens

During the setup-renv@v2 step, restore output shows a package being installed successfully and then immediately failing its load test because a transitive dependency is not yet available.

Error excerpt:

Error: error testing if 'progress' can be loaded [error code 1]
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
  there is no package called ‘rlang’

In this case:

  • progress was being tested after install
  • progress depends on hms
  • hms depends on rlang
  • rlang was present in renv.lock

So this looks like either:

  • package validation occurring before the full dependency graph is available in the project library,
  • or a cache/library restore state that leaves the library inconsistent during validation.

Environment

  • GitHub Actions runner: ubuntu-24.04
  • Job uses a container: rocker/r-ver:4.6.0
  • Action: r-lib/actions/setup-renv@v2

Workflow shape

The relevant part of the workflow is essentially:

jobs:
  check:
    runs-on: ubuntu-24.04
    container:
      image: rocker/r-ver:4.6.0

    steps:
      - uses: actions/checkout@v5

      - name: Install system dependencies
        run: |
          apt-get update
          apt-get install -y curl libpq-dev libwebp-dev libuv1

      - name: Install dependencies using renv
        uses: r-lib/actions/setup-renv@v2
        env:
          RENV_CONFIG_SANDBOX_ENABLED: FALSE

Relevant renv.lock extract

The missing package was present in the lockfile. Relevant entries:

"progress": {
  "Package": "progress",
  "Version": "1.2.3",
  "Requirements": ["R", "R6", "crayon", "hms", "prettyunits"]
},
"hms": {
  "Package": "hms",
  "Version": "1.1.4",
  "Requirements": ["cli", "lifecycle", "methods", "pkgconfig", "rlang", "vctrs"]
},
"rlang": {
  "Package": "rlang",
  "Version": "1.3.0",
  "Requirements": ["R", "utils"]
}

Expected behavior

If all required packages are present in renv.lock, restore should complete successfully, or at least not fail load validation because a transitive dependency has not yet been made available.

Actual behavior

The action fails during restore/package validation with a missing transitive dependency error, despite that dependency being declared in the lockfile.

Notes

I can’t share the original repository because it is private, but I can help reduce this to a minimal reproduction if that would be useful.

Question

Is this a known issue with setup-renv@v2 in containerized jobs, or is there a recommended configuration to avoid package load testing against a partially restored library?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behaviorhelp wanted ❤️we'd love your help!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions