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.

Related guides

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