Skip to content
Latchkey

Liquibase "Could not acquire change log lock" in CI

Liquibase takes a lock by setting the row in DATABASECHANGELOGLOCK before applying changes. If a prior run was killed (a cancelled job, a timeout), the lock stays set, so the next run waits and then fails to acquire it.

What this error means

liquibase update prints "Waiting for changelog lock...." repeatedly and then fails with "Could not acquire change log lock. Currently locked by <host> since <time>".

liquibase output
Waiting for changelog lock....
Liquibase: Could not acquire change log lock. Currently locked by 10.0.0.5 (10.0.0.5)
since 6/30/26, 9:14 AM

Common causes

A previous run was killed while holding the lock

A cancelled or timed-out CI job left the DATABASECHANGELOGLOCK row set, so the lock is never released.

Two migration runs overlap on the same database

Concurrent jobs target the same database and one holds the lock while the other waits.

How to fix it

Release the stale lock

When you are sure no run is active, release the lock and re-run update.

Terminal
liquibase releaseLocks
liquibase update

Serialize migrations on a database

  1. Ensure only one migration job runs against a given database at a time.
  2. For disposable CI databases, recreate the database instead of releasing locks.
  3. Add a timeout so a hung run does not hold the lock indefinitely.

How to prevent it

  • Run one migration job per database; do not overlap them.
  • Use fresh databases in CI so stale locks never carry over.
  • Release the lock only when no migration is genuinely running.

Related guides

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