pnpm: Installs fail with ERR_PNPM_FETCH_429 in some environments

Last pnpm version that worked

9.15.2

pnpm version

9.15.3

Code to reproduce the issue

Running docker build . of our public repo https://github.com/jsdelivr/globalping-dash-directus (checkout commit 6d415b32da344f748da8b57bcbc02d09f874b24f as I’m going to pin 9.15.2 for now), which contains a pnpm install command.

Expected behavior

Dependencies install as usual.

Actual behavior

We’re seeing a great number of network-related errors, but only with pnpm 9.15.3. Downgrading to 9.15.2 fixes the problem immediately:

 WARN  GET https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz error (ERR_PNPM_FETCH_429). Will retry in 10 seconds. 2 retries left.
 WARN  GET https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz error (ERR_PNPM_FETCH_429). Will retry in 10 seconds. 2 retries left.
 WARN  GET https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz error (ERR_PNPM_FETCH_429). Will retry in 10 seconds. 2 retries left.
 WARN  GET https://registry.npmjs.org/es-abstract/-/es-abstract-1.23.3.tgz error (ERR_PNPM_FETCH_429). Will retry in 10 seconds. 2 retries left.
 WARN  GET https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.4.tgz error (ERR_PNPM_FETCH_429). Will retry in 10 seconds. 2 retries left.
 WARN  GET https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.3.tgz error (ERR_PNPM_FETCH_429). Will retry in 10 seconds. 2 retries left.
 WARN  GET https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.3.tgz error (ERR_PNPM_FETCH_429). Will retry in 10 seconds. 2 retries left.
 WARN  GET https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.1.tgz error (ERR_PNPM_FETCH_429). Will retry in 10 seconds. 2 retries left.
 WARN  GET https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.0.0.tgz error (ERR_PNPM_FETCH_429). Will retry in 10 seconds. 2 retries left.
 WARN  GET https://registry.npmjs.org/is-data-view/-/is-data-view-1.0.1.tgz error (ERR_PNPM_FETCH_429). Will retry in 10 seconds. 2 retries left.
 WARN  GET https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz error (ERR_PNPM_FETCH_429). Will retry in 10 seconds. 2 retries left.
 WARN  GET https://registry.npmjs.org/data-view-buffer/-/data-view-buffer-1.0.1.tgz error (ERR_PNPM_FETCH_429). Will retry in 10 seconds. 2 retries left.
 WARN  GET https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz error (ERR_PNPM_FETCH_429). Will retry in 10 seconds. 2 retries left.
 WARN  GET https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz error (ERR_PNPM_FETCH_429). Will retry in 10 seconds. 2 retries left.
 WARN  GET https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.[15](https://github.com/jsdelivr/globalping-dash-directus/actions/runs/12395977588/job/35323844519#step:4:16).tgz error (ERR_PNPM_FETCH_429). Will retry in 10 seconds. 2 retries left.
 WARN  GET https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.13.tgz error (ERR_PNPM_FETCH_429). Will retry in 10 seconds. 2 retries left.

Additional information

I can reproduce this reliably in:

  • Docker on Windows locally,
  • GitHub actions (Linux) at this step - no Docker involved directly, but the whole action runs in a container, so maybe that’s related - see Install dependencies step here for logs with the errors.

On GitHub actions, the error rate seems lower, so the install eventually succeeds. Locally, it’s higher, and pnpm eventually gives up. The errors happen even when I set --network-concurrency 1

I can NOT seem to reproduce this outside of Docker on Windows locally, and my colleague with a Mac can’t reproduce even with Docker.

Node.js version

v20.18.1

Operating System

Windows

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 34
  • Comments: 66 (14 by maintainers)

Commits related to this issue

Most upvoted comments

I have released pnpm v9.15.4. See if it helps.

@wspurgin My team was also hitting this with 9.15.2, we ended up upgrading and pinning to 9.15.5 and that fixed it for us.

Thanks @bgandy94! As @zkochan noted, this problem isn’t version specific but is very much an NPM registry rate limiting problem. The version change will change the user-agent config that is assigned by default. Which means NPM doesn’t see the “problem” user-agent anymore and allows your requests.

However, it’s just a matter of time before enough GitHub actions are run with that version of PNPM for the registry to rate limit that user agent too. In short, it’s a temporary fix. In a few weeks (or less), you’ll probably hit the same rate-limiting problem on 9.15.5 (at least that’s been our experience since 9.15.3).

I’m interested to hear if anyone else tried custom user-agents, but my team is gonna introduce that today and observe for the next few weeks… I’ll post back with what we learn.

Pinning to pnpm 9.15.2 seems to still work for those on GitHub Actions.

npm install -g pnpm@9.15.2

What the hell, yeah. I have no clue what is going on here. I downgraded from 9.15.3 (latest) to 9.15.2, and suddenly it works fine. This is when running a Github action (failed build https://github.com/Aeolun/writer2/actions/runs/12747332241/job/35525192191).

It’s fine after I downgrade to 9.15.2 🤷 https://github.com/Aeolun/writer2/actions/runs/12747453768/job/35525547506

Same issue

Alas, now my team and I are hitting this in GHA on 9.15.2

@zkochan did this suggestion to update the user agent prove to be a lasting solution for you? (or @s01868 - since I saw you said it worked for you at the time a few weeks back) https://github.com/pnpm/pnpm/issues/8953#issuecomment-2588231111

It feels like a registry issue. Maybe they have configured some rate limiting by user agent and because v9.15.2 isn’t latest, it gets less requests and fails less frequently. You could also try setting custom user agents via the user-agent setting in .npmrc. For instance:

user-agent=pnpm/9.15.0 npm/? node/v20.18.1 darwin arm64

npm support replied they that are working on this issue and asked me to let them know if it’s still happening. I personally haven’t run into this in a while, but if someone has, please post the failed CI run link here.

Same issue

Happens in github actions

Experiencing the same issue with version 9.15.2. Upgrading to 9.15.5 resolved the problem.

Image

For anyone using pnpm/action-setup@v4, you can add this to your package.json:

{
  "packageManager": "pnpm@9.15.2"
}

Note that you should not pass a version input to the github action if you’re using the packageManager field or else you’ll get this error:

Error: Multiple versions of pnpm specified:
  - version 9 in the GitHub Action config with the key "version"
  - version pnpm@9.15.2 in the package.json with the key "packageManager"

upgrading to 9.15.4 didn’t work, but customising user-agent as suggested here worked!

It feels like a registry issue. Maybe they have configured some rate limiting by user agent and because v9.15.2 isn’t latest, it gets less requests and fails less frequently. You could also try setting custom user agents via the user-agent setting in .npmrc. For instance:

user-agent=pnpm/9.15.0 npm/? node/v20.18.1 darwin arm64

It feels like a registry issue. Maybe they have configured some rate limiting by user agent and because v9.15.2 isn’t latest, it gets less requests and fails less frequently. You could also try setting custom user agents via the user-agent setting in .npmrc. For instance:

user-agent=pnpm/9.15.0 npm/? node/v20.18.1 darwin arm64

Having the same problem in my production code when installing PNPM in my Dockerfile. Reverting to 9.15.2 fixes the issue.

If you have a step that does npm i -g pnpm in your build, change it to be npm i -g pnpm@9.15.2 and it’ll work like a charm.

Same issue

@wspurgin My team was also hitting this with 9.15.2, we ended up upgrading and pinning to 9.15.5 and that fixed it for us.

Thanks @bgandy94! As @zkochan noted, this problem isn’t version specific but is very much an NPM registry rate limiting problem. The version change will change the user-agent config that is assigned by default. Which means NPM doesn’t see the “problem” user-agent anymore and allows your requests.

However, it’s just a matter of time before enough GitHub actions are run with that version of PNPM for the registry to rate limit that user agent too. In short, it’s a temporary fix. In a few weeks (or less), you’ll probably hit the same rate-limiting problem on 9.15.5 (at least that’s been our experience since 9.15.3).

I’m interested to hear if anyone else tried custom user-agents, but my team is gonna introduce that today and observe for the next few weeks… I’ll post back with what we learn.

Okay coming back after observing for quite awhile.

TL;DR - configuring custom user agents seems to fix this entirely whenever it happens

My team has been using a small little custom GHA to create a realistic but slightly fudged the user agent:

name: "Setup PNPM and Install"
description: "Setup PNPM at the target version"
inputs:
  working-directory:
    description: "The working directory to run PNPM commands in"
    required: true
    default: "."
  target_version:
    description: "The target version of PNPM to install"
    required: true
    default: "9.15.5"

runs:
  using: "composite"
  steps:
    - name: Install PNPM
      shell: bash
      run: |
        npm install -g pnpm@${{ inputs.target_version }}
        echo "pnpm version: $(pnpm --version)"
        userAgentVersion=$(node -p -e "
          const [newMajor, newMinor, newPatch] = [10, 50, 100]
            .map((x) => Math.floor(Math.random() * x));

          util.format('%d.%d.%d', newMajor, newMinor, newPatch);
        ")
        npm config set user-agent "pnpm/$(echo $userAgentVersion) npm/$(npm --version) node/$(node --version) $(node -e 'process.platform' -p) $(node -e 'process.arch' -p) ci/github-actions"
        echo "using user-agent: $(npm config get user-agent)"
        pnpm install
      working-directory: ${{ inputs.working-directory }}

You may want to install pnpm differently but the important element is this script:

        echo "pnpm version: $(pnpm --version)"
        userAgentVersion=$(node -p -e "
          const [newMajor, newMinor, newPatch] = [10, 50, 100]
            .map((x) => Math.floor(Math.random() * x));

          util.format('%d.%d.%d', newMajor, newMinor, newPatch);
        ")
        npm config set user-agent "pnpm/$(echo $userAgentVersion) npm/$(npm --version) node/$(node --version) $(node -e 'process.platform' -p) $(node -e 'process.arch' -p) ci/github-actions"
        echo "using user-agent: $(npm config get user-agent)"

This sets the user-agent npm uses to a realistic value but “spoofs” the pnpm version to a random semver from 0.0.0 to 10.50.100 - a total of 50K combinations.

Prior to this we’d observe rate-limiting with the default user-agent ~2 weeks (likely due to a lot of GHA using that same pnpm version). Now we haven’t hit it at all. And, if the math / trend holds, we have ~1,920 years worth of combinations before we hit it again. Hopefully by then the npm registry and GitHub have come to some modus vivendi.

Well, at least now we know that this isn’t a bug in pnpm. I did not make any fixes related to this in pnpm v9.15.5. Could anyone fix the issue by changing the user agent setting?

@wspurgin My team was also hitting this with 9.15.2, we ended up upgrading and pinning to 9.15.5 and that fixed it for us.

Pinning to v9.15.4 also seems to have worked for us, where we’re running CI/CD via GitHub Actions

I have forked this repo to try to reproduce the issue: https://github.com/pnpm/pnpm/issues/8953#issuecomment-2587011675

But it didn’t fail for me with 9.15.3: https://github.com/zoli-forks/writer2/actions/runs/12752793272/job/35543039421

So, I have no idea what is happening. I hope it works with 9.15.4

To solve the issue, I updated the workflow to ensure the specific version 9.15.2 of pnpm is used. Here’s how I addressed the problem:

- name: Setup pnpm 9.15.2
        run: |
          npm install -g pnpm@9.15.2

And, Replaced npx pnpm with pnpm commands

I can’t downgrade the version of latest only release a new version and make it latest. I will do it but I don’t understand how would it fix anything.

It should be possible to “downgrade” the tag via npm dist-tag add pnpm@9.15.2 latest without making a new release.

I don’t know if it’s possible but may I suggest a rollback of 9.15.3 until this is figured out? Our github and vercel ci/cd is now having this issue, I would prefer not to pin to 9.15.2 on all our repositories or use the mirror except as a last resort.

How did you fix it in vercel?. My local pnpm version is 9.13.2

@sankaSanjeeva I got those errors after upgrading to 9.15.3. It can be fixed by downgrading to 9.15.2, but I’m not sure if it fits in your case.