Liquibase "Rollback failed" / Missing Rollback in CI
Liquibase tried to roll back a changeset and could not. Either the change has no automatic inverse (e.g. sql/dropColumn with data) and no explicit <rollback>, or the rollback SQL itself errored. This is about the changeset definition, not connectivity.
What this error means
liquibase rollback/rollbackCount/updateTestingRollback fails reporting it cannot compute an inverse, or the rollback statements error. It is deterministic for a given changeset.
Unexpected error running Liquibase: liquibase.exception.RollbackImpossibleException:
No inverse to liquibase.change.core.RawSQLChange could be calculatedCommon causes
Change has no automatic inverse
Raw sql, dropTable, or data changes cannot be auto-reversed. Without an explicit <rollback> block, Liquibase cannot roll them back.
Rollback SQL itself fails
A provided rollback that references an object that no longer exists, or has a SQL error, fails when executed.
updateTestingRollback in CI exercises rollback
updateTestingRollback applies, rolls back, then re-applies each changeset - so a missing/broken rollback surfaces in CI even if normal updates pass.
How to fix it
Add an explicit rollback to the changeset
Define how to reverse changes that have no automatic inverse.
<changeSet id="add-orders-status" author="alice">
<addColumn tableName="orders">
<column name="status" type="text"/>
</addColumn>
<rollback>
<dropColumn tableName="orders" columnName="status"/>
</rollback>
</changeSet>Fix or test the rollback SQL
- Run
liquibase updateTestingRollbackin CI to exercise each rollback. - Correct rollback statements that reference now-missing objects.
- For irreversible data changes, document that rollback is not supported rather than leaving a broken block.
How to prevent it
- Provide
<rollback>for any change without an automatic inverse. - Run
updateTestingRollbackin CI to validate rollbacks. - Treat rollback definitions as part of the changeset, reviewed together.