Liquibase "Validation Failed: checksum changed" in CI
Liquibase records an MD5 checksum of each changeset in DATABASECHANGELOG. On update it recomputes the checksum; if a changeset that already ran was modified, the values differ and Liquibase fails validation.
What this error means
liquibase update fails with "Validation Failed: ... changeset ... was modified since the migration was run" or that the computed checksum differs from the recorded one.
Unexpected error running Liquibase: Validation Failed:
1 changesets check sum
db/changelog/002-add-orders.sql::2::alice was: 8:abc... but is now: 8:def...Common causes
A changeset that already ran was edited
Modifying an applied changeset (its SQL, formatting, or attributes) changes the checksum, which no longer matches the recorded one.
Whitespace or attribute changes shifted the checksum
Reformatting or attribute edits can change the computed checksum even when the intent is unchanged.
How to fix it
Add a new changeset instead of editing applied ones
Revert the edit and add a new changeset for the change, keeping applied changesets immutable.
<!-- leave applied changesets untouched; add a new one -->
<changeSet id="3" author="alice"> ... </changeSet>Clear checksums if the change is intentional
liquibase clearCheckSums resets recorded checksums so the next update recomputes them. Use only when you deliberately changed an applied changeset.
liquibase clearCheckSums
liquibase updateHow to prevent it
- Treat applied changesets as immutable.
- Add new changesets rather than editing old ones.
- Avoid reformatting applied changelog files.