Skip to content
Latchkey

Yarn Berry "YN0000: ... couldn't be located" cache miss in CI

Under an immutable install Yarn Berry expects every package to already be present in .yarn/cache. When an archive is missing (and Yarn is not allowed to fetch or write it), it fails saying the package could not be located.

What this error means

yarn install fails with a "YN0000" line reporting a package "couldn't be located" and that fetching it would violate the immutable cache, often after switching to zero-installs partially.

yarn
YN0000: Fetch step
YN0013: | lodash@npm:4.17.21 can't be found in the cache and will be fetched from the remote registry
Error: The remote archive for lodash@npm:4.17.21 couldn't be located and the cache is immutable

Common causes

The committed cache is incomplete

Zero-installs requires .yarn/cache to hold every archive; a missing or gitignored entry cannot be fetched under an immutable cache.

A lockfile change without a matching cache update

A dependency was added and yarn.lock updated, but the new archive was never added to .yarn/cache.

How to fix it

Repopulate and commit the cache

  1. Run yarn install locally so the missing archive is fetched into .yarn/cache.
  2. Confirm .yarn/cache is committed and not gitignored.
  3. Push so CI finds every archive.
Terminal
yarn install
git add .yarn/cache yarn.lock

Or allow immutable cache to fetch instead

If you do not commit the cache, disable the immutable cache guard so CI can fetch and cache archives itself (then persist via CI cache).

.github/workflows/ci.yml
- run: yarn install --immutable --immutable-cache=false

How to prevent it

  • For zero-installs, commit the complete .yarn/cache with every lockfile change.
  • Do not gitignore .yarn/cache if you rely on committed archives.
  • Otherwise cache .yarn/cache in CI and let Yarn fetch what is missing.

Related guides

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