Skip to content

Lockfile verification cache never restores when devEngines warns about the Node version #73

Open

Description

@alvarosevilla95

With devEngines.runtime.onFail: "warn" in package.json, the lockfile verification cache is never restored or saved. Nothing in the log says why. Every job prints Lockfile verification cache is not found, even when an entry with that exact key is in the repo's Actions cache, and no job saves a new one. In our repo, verifying went from cached to 8.3 s per job.

Cause

The action restores the verification cache before it installs the project's runtime, so pnpm cache path runs under the runner's Node. pnpm then prints its devEngines warning on stdout, before the path (pnpm/pnpm#16584):

[WARN] This project requires Node.js 26.10.0. Your current Node.js is v24.18.0
/home/runner/.cache/pnpm

runPnpmCachePath returns all of stdout, so the cache file's path starts with the warning:

  • the restore misses, because the path is part of the cache version;
  • the save returns early at !existsSync(cacheFilePath), without logging.

With onFail: "error", pnpm cache path exits with 1, the action falls back to pnpm's default directory, and the cache works. That's why ours broke the day we switched from error to warn.

Reproduce

# package.json: "devEngines": { "runtime": { "name": "node", "version": "26.10.0", "onFail": "warn" } }
- uses: pnpm/setup@fbda4c85fc2e1e08721cd8763afea8f48d60f024 # v3.0.0
  with:
    cache: false

Run it twice on the same lockfile. Both runs log Lockfile verification cache is not found, and neither logs Lockfile verification cache saved.

Locally, under any other Node:

pnpm cache path 2>/dev/null   # two lines with "warn", one with "ignore"

Possible fixes

  • Run pnpm cache path --loglevel=error. The flag hides the warning; setting the log level from the environment doesn't.
  • Or take the last non-empty line of stdout.
  • Log a warning when the save skips because the file is missing. That would have made this findable from the job log.

We've worked around it with onFail: "ignore".

Versions: pnpm/setup v3.0.0 (fbda4c8), pnpm 12.6.0 (also 12.9.1), ubuntu-latest.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions