Skip to content
Latchkey

Bun "lockfile had changes, but lockfile is frozen" in CI

You ran bun install --frozen-lockfile (Bun's default in CI) and the dependency set Bun resolved from package.json differs from the committed bun.lockb. Bun refuses to modify the lockfile and fails instead.

What this error means

CI stops with "error: lockfile had changes, but lockfile is frozen" while a plain bun install works locally and updates the lockfile.

Terminal
bun install --frozen-lockfile
error: lockfile had changes, but lockfile is frozen

Common causes

package.json changed without updating bun.lockb

A dependency was added, removed, or bumped in package.json but the resolved bun.lockb was not regenerated and committed.

CI enforces a frozen lockfile by default

Bun treats install as frozen when CI is set (or you pass --frozen-lockfile), so any drift is an error rather than a silent relock.

How to fix it

Regenerate and commit the lockfile

  1. Run bun install locally to update bun.lockb for the new package.json.
  2. Commit the updated bun.lockb alongside the package.json change.
  3. Re-run CI so the frozen install now matches.
Terminal
bun install
git add bun.lockb package.json
git commit -m "Update bun lockfile"

Keep the frozen check in CI

Install with the frozen flag explicitly so lockfile drift fails fast and lands with the dependency change.

.github/workflows/ci.yml
- run: bun install --frozen-lockfile

How to prevent it

  • Run bun install and commit bun.lockb whenever package.json deps change.
  • Keep --frozen-lockfile in CI so drift is caught early.
  • Review bun.lockb diffs in pull requests.

Related guides

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