CustomChange executed twice: integration with python

Hello guys.
I have a python project and for database migrations we use liquibase. For database migrations I wrote simple Java class that executes some python script with parameter from migration.
Example of the xml file with migration:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns=""
    <changeSet id="2" author="sergii_glazyrin">
        <customChange class="proj.ExecutePythonMigration">
            <param name="command" value="create-system-user"/>

and this ExecutePythonMigration is the implementation of the CustomTaskChange interface:

public class ExecutePythonMigration implements CustomTaskChange {

But method execute in this ExecutePythonMigration executed twice. I debugged it, removed everything from execute method. And just kept there logging of the severe message to understand how many times this method was executed. And I’ve got this debug message twice.

Liquibase version: 4.20
DB: postgres
Liquibase properties file:


What could be wrong ?
Do you need more information to track down this issue ?

We are facing the same issue on upgrade of Liquibase from 3.10.3 to 4.20.0.

Looking through the code, it seems that the ChangeSet.execute(…) method has added a call to addSqlMdc(…) which is triggering the additional invocation of generateStatements method if you have extended CustomTaskChange class

hello, thanks for the reply. Is there any workaround for this ?


We have downgraded to v4.17.2 to resolve this issue.

The method call to “addSqlMdc” which is calling the duplicate invocation of generateStatements(…) was added in version 4.19.1

You can try 4.19.0 or 4.18.0 also if you are looking for specific features introduced in either of these versions