What happens
Every job using pnpm/setup@v2.1.0 with a runtime to install gets a warning annotation:
Unable to determine the installed runtime versions: Unexpected token 'W', "[WARN] Usin"... is not valid JSON
The runtime itself installs fine — only the version refinement (and the cache key it feeds) falls back.
Why
getInstalledRuntimeVersions (src/install-runtime/index.ts) does:
const stdout = await runPnpmForOutput(binDest, ['list', '--global', '--json', '--depth', '0'])
const listing = JSON.parse(stdout)
pnpm 12 writes a warning to stdout, ahead of the JSON, when the project configures pmOnFail:
[WARN] Using --global skips the package manager check for this project
so JSON.parse sees [WARN] Usin....
Repro (pnpm 12.4.1)
mkdir repro && cd repro
printf '{"name":"t","version":"1.0.0"}' > package.json
printf 'pmOnFail: warn\n' > pnpm-workspace.yaml # `error` does it too; removing the key does not
pnpm list --global --json --depth 0 | head -1
# [WARN] Using --global skips the package manager check for this project
Suggested fix
pnpm list --reporter=silent --global --json --depth 0 returns clean JSON in the same repro. Alternatively, slice from the first [ before parsing, so any future stdout noise is tolerated — the comment above the function already says this path must never break setup.
Happy to send a PR if you'd like.
What happens
Every job using
pnpm/setup@v2.1.0with a runtime to install gets a warning annotation:The runtime itself installs fine — only the version refinement (and the cache key it feeds) falls back.
Why
getInstalledRuntimeVersions(src/install-runtime/index.ts) does:pnpm 12 writes a warning to stdout, ahead of the JSON, when the project configures
pmOnFail:so
JSON.parsesees[WARN] Usin....Repro (pnpm 12.4.1)
Suggested fix
pnpm list --reporter=silent --global --json --depth 0returns clean JSON in the same repro. Alternatively, slice from the first[before parsing, so any future stdout noise is tolerated — the comment above the function already says this path must never break setup.Happy to send a PR if you'd like.