Skip to content
Latchkey

Bun install registry network / connection error in CI

Bun opened a connection to the registry but the download timed out or the connection dropped mid-transfer. This is typically transient network flakiness rather than a bad request or bad auth.

What this error means

bun install fails with a connection or timeout error against the registry host, and a retry on the same job or a re-run often succeeds.

Terminal
bun install
error: ConnectionRefused downloading https://registry.npmjs.org/react
error: Failed to install

Common causes

Transient network slowness or a dropped connection

A slow mirror, momentary packet loss, or a large tarball makes the download stall or the socket drop before completion.

A flaky or rate-limited registry mirror

The configured registry returns intermittent errors or throttles the runner, so some downloads fail while others succeed.

How to fix it

Retry the install and cache the store

  1. Re-run the install; transient drops usually clear on retry.
  2. Cache ~/.bun/install/cache so already-downloaded packages are reused.
  3. Point at a reliable registry mirror for your region.
.github/workflows/ci.yml
- uses: actions/cache@v4
  with:
    path: ~/.bun/install/cache
    key: bun-${{ hashFiles('bun.lockb') }}
- run: bun install --frozen-lockfile

Set the registry explicitly

Pin a known-good registry in bunfig.toml so Bun does not fall back to a flaky mirror.

bunfig.toml
[install]
registry = "https://registry.npmjs.org/"

How to prevent it

  • Cache the Bun install cache to avoid re-downloading on flakes.
  • Pin a reliable registry in bunfig.toml.
  • Retry install on transient network errors.

Frequently asked questions

What causes "bun install registry timeout"?
A slow mirror, momentary packet loss, or a large tarball makes the download stall or the socket drop before completion.
How do I fix bun install registry timeout?
Retry the install and cache the store

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card