Skip to content
Latchkey

Yarn Berry "The remote server failed to provide the requested resource" in CI

Yarn Berry tried to download a package archive and the registry did not return it: a 404 for a missing or private package, a 5xx, or a dropped connection. Yarn reports the remote server failed to provide the resource.

What this error means

yarn install fails with "Error: <pkg>: The remote server failed to provide the requested resource" and a "Response Code: 404" or "500" for a package URL.

yarn
Error: @acme/utils@npm:1.0.0: The remote server failed to provide the requested resource

  Response Code: 404 (Not Found)
  Request Method: GET

Common causes

A private package requested from the public registry (404)

A scoped internal package is fetched from registry.yarnpkg.com, which does not host it, returning 404.

Transient registry 5xx or connection drop

A momentary registry error or reset connection returns a 5xx, which a retry usually clears.

How to fix it

Configure the scoped registry and token

Point the scope at the registry that hosts it and supply the auth token via an env var.

.yarnrc.yml
npmScopes:
  acme:
    npmRegistryServer: "https://npm.internal.example.com"
    npmAuthToken: "${NPM_TOKEN}"

Raise HTTP retries for transient failures

For 5xx or connection resets, increase Yarn's HTTP retry count so a blip does not fail the job.

.yarnrc.yml
httpRetry: 5
httpTimeout: 120000

How to prevent it

  • Configure npmScopes for private packages so requests reach the right host.
  • Set httpRetry for flaky networks.
  • Commit or cache .yarn/cache so most archives are served locally.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →