Skip to content
Latchkey

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

CI ran bun install --frozen-lockfile (the default in CI environments), but package.json does not match bun.lockb. Bun refuses to change the lockfile in frozen mode, so it fails instead of silently re-resolving.

What this error means

bun install fails with "lockfile had changes, but lockfile is frozen". It happens after someone edits dependencies in package.json without re-running bun install to update bun.lockb.

bun output
error: lockfile had changes, but lockfile is frozen
note: try re-running without --frozen-lockfile

Common causes

package.json edited without re-locking

A dependency was added, removed, or bumped in package.json, but bun.lockb was not regenerated, so the two disagree.

Lockfile not committed

If bun.lockb is gitignored or stale in the repo, CI cannot reproduce the resolved set and the frozen check fails.

How to fix it

Regenerate and commit the lockfile

Run a normal install locally to update the lockfile, then commit it.

Terminal
bun install
git add bun.lockb && git commit -m "Update bun.lockb"

Keep --frozen-lockfile in CI

Frozen installs are correct for CI - they guarantee reproducibility. Fix the lockfile drift rather than removing the flag.

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

How to prevent it

  • Run bun install after any package.json change and commit bun.lockb.
  • Keep --frozen-lockfile in CI to catch drift in PRs.
  • Do not gitignore bun.lockb.

Related guides

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