Resolving Liquibase Checksum Validation Failures
Learn how to diagnose and fix 'Checksum Validation Failed' errors in Liquibase. This guide covers validCheckSum attributes, clearChecksums, and manual table corrections.
25 Aug 2025, 05:11 UTC

The Checksum Mismatch Problem
When you run liquibase update, Liquibase compares the MD5 hash of every executed changeset in your changelog files against the hash stored in the DATABASECHANGELOG table. If a changeset is modified after it has already been deployed, the hashes will not match, and Liquibase will halt all further migrations with a Checksum Validation Failed error.
The primary takeaway: Liquibase treats modified changesets as a risk to database consistency. To resolve this, you must either revert the change, tell Liquibase the new hash is acceptable, or reset the stored hashes.
Diagnostic Matrix: Identifying the Cause
Use the following table to determine why the validation failed based on your recent activity.
| Observed Change | Likely Cause | Risk Level |
|---|---|---|
| Whitespace or comment changes | Formatting updates in XML/YAML/SQL files | Low |
| SQL logic modification | Attempting to "fix" a deployed migration | High (Schema Drift) |
| Changed Liquibase version | Different hashing algorithms between versions | Medium |
| Moved changeset to new file | ID/Author/Filepath mismatch | Medium |
Step-by-Step Resolution Path
Follow these checks in order. Stop as soon as the migration succeeds.
Check 1: Revert Accidental Formatting Changes
If the logic of the SQL hasn't changed, but you modified indentation or added comments, the simplest fix is to revert those changes. Liquibase calculates the checksum based on the content of the changeset; even a single extra space can trigger a failure.
Check 2: Use validCheckSum for Intentional Changes
If you intentionally modified a changeset (e.g., adding a non-destructive comment or fixing a typo in a column description) and want Liquibase to accept both the old and new versions, use the validCheckSum attribute.
Configuration Example (XML):
<changeSet id="123" author="dev-team" validCheckSum="8:a1b2c3d4e5f6g7h8">
<createTable tableName="users">
<column name="username" type="varchar(255)"/>
</createTable>
</changeSet>
To find the required checksum value, run the update command, capture the "Actual Checksum" from the error log, and paste it into the attribute.
Check 3: Clear All Checksums
If you have performed a bulk update to your changelogs or upgraded your Liquibase version and hundreds of changesets are failing, you can reset the entire table. This does not re-run the SQL; it simply clears the MD5SUM column so Liquibase can re-calculate and store the current hashes on the next run.
Command Execution:
# Run from your terminal/CLI with appropriate DB permissions
liquibase clearChecksums
Risk: Only use this if you are certain that the current state of your changelog files accurately reflects the current state of your database. If a changeset was modified to drop a table and you clear checksums, you may lose track of whether that operation actually occurred.
Check 4: Manual Table Correction
For a single, critical failure where you cannot modify the code, you can manually update the DATABASECHANGELOG table. This requires UPDATE permissions on the Liquibase metadata table.
SQL Command:
UPDATE DATABASECHANGELOG
SET MD5SUM = 'new_checksum_from_log'
WHERE ID = 'changeset_id' AND AUTHOR = 'author_name';
Verification and Results
To verify the fix, execute the update command again:
liquibase update
If successful, the output will show that the modified changesets were skipped (because they are already marked as executed) and subsequent new changesets were applied. You can verify the stored hashes by querying the database:
SELECT ID, MD5SUM FROM DATABASECHANGELOG WHERE ID = 'your_changeset_id';
Escalation Criteria
If the following conditions occur, stop using the methods above and create a new migration changeset instead:
- The modification changes the actual schema (e.g., changing a
VARCHAR(50)toVARCHAR(100)). - The changeset involves data migration (DML) that must be idempotent.
- You are working in a production environment where auditing of the
DATABASECHANGELOGis required for compliance.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.