{"record":{"id":"1d35fcdf346b1706","repo":"quarkusio/quarkus","slug":"error-starting-liquibase-1d35fc","errorCode":null,"errorMessage":"Error starting Liquibase","messagePattern":"Error starting Liquibase","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"extensions/liquibase/liquibase/runtime/src/main/java/io/quarkus/liquibase/runtime/LiquibaseSchemaProvider.java","lineNumber":22,"sourceCode":"\nimport io.quarkus.arc.InstanceHandle;\nimport io.quarkus.datasource.runtime.DatabaseSchemaProvider;\nimport io.quarkus.liquibase.LiquibaseFactory;\nimport liquibase.Liquibase;\nimport liquibase.exception.LiquibaseException;\n\npublic class LiquibaseSchemaProvider implements DatabaseSchemaProvider {\n    @Override\n    public void resetDatabase(String dbName) {\n        try {\n            try {\n                LiquibaseFactory liquibaseFactory = LiquibaseFactoryUtil.getLiquibaseFactory(dbName).get();\n                doReset(liquibaseFactory);\n            } catch (UnsatisfiedResolutionException e) {\n                //ignore, the DS is not configured\n            }\n        } catch (Exception e) {\n            throw new IllegalStateException(\"Error starting Liquibase\", e);\n        }\n    }\n\n    @Override\n    public void resetAllDatabases() {\n        try {\n            for (InstanceHandle<LiquibaseFactory> liquibaseFactoryHandle : LiquibaseFactoryUtil.getActiveLiquibaseFactories()) {\n                try {\n                    LiquibaseFactory liquibaseFactory = liquibaseFactoryHandle.get();\n                    doReset(liquibaseFactory);\n                } catch (UnsatisfiedResolutionException e) {\n                    //ignore, the DS is not configured\n                }\n            }\n        } catch (Exception e) {\n            throw new IllegalStateException(\"Error starting Liquibase\", e);\n        }\n    }","sourceCodeStart":4,"sourceCodeEnd":40,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/liquibase/liquibase/runtime/src/main/java/io/quarkus/liquibase/runtime/LiquibaseSchemaProvider.java#L4-L40","documentation":"LiquibaseSchemaProvider.resetDatabase (used by the Dev Services / dev mode database reset feature) resolves the LiquibaseFactory for the named database and calls doReset (dropAll). Any exception other than UnsatisfiedResolutionException (datasource not configured, which is ignored) is rethrown as IllegalStateException('Error starting Liquibase'). The wrapped cause holds the real failure, typically from dropping the schema.","triggerScenarios":"Dev mode/database reset invokes resetDatabase(dbName); doReset's liquibase.dropAll() throws — active connections prevent dropping, insufficient DB privileges to DROP objects, or the changelog/datasource is misconfigured. UnsatisfiedResolutionException for an unconfigured DB is swallowed, everything else is wrapped.","commonSituations":"Resetting a dev database while other sessions/tables hold locks; DB user lacking DROP rights; dropping a schema with foreign keys/objects Liquibase can't remove; trying to reset a named datasource that exists but is misconfigured.","solutions":["Inspect the 'Caused by' LiquibaseException for which object failed to drop.","Close other connections to the dev database (other apps, DB clients) before resetting.","Grant the DB user sufficient privileges to drop its schema objects.","Ensure the datasource for dbName is properly configured and reachable.","As a workaround, drop and recreate the dev database/container instead of reset."],"exampleFix":"# before: reset fails due to lingering connections\n# after: terminate sessions first, e.g. for Postgres\nSELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname='mydb' AND pid <> pg_backend_pid();\n# then trigger the reset again","handlingStrategy":"try-catch","validationCode":"// Before resetting, ensure no other sessions hold the DB:\n// SELECT COUNT(*) FROM pg_stat_activity WHERE datname = 'mydb';\n// and that the user can drop objects:\n// SELECT has_database_privilege(current_user, 'mydb', 'CREATE');","typeGuard":null,"tryCatchPattern":"try {\n    schemaProvider.resetDatabase(\"mydb\");\n} catch (IllegalStateException e) {\n    if (\"Error starting Liquibase\".equals(e.getMessage())) {\n        log.error(\"Reset of DB '{}' failed: {}\", \"mydb\", e.getCause().getMessage());\n    }\n}","preventionTips":["Stop sibling apps/DB clients before resetting a dev database.","Grant the dev DB user DROP privileges on its schema.","Reset databases one at a time to isolate failures.","Recreate the dev container (Dev Services) instead of repeated drop-all cycles."],"tags":["liquibase","database-reset","dev-mode","drop-all"],"backgroundTag":"liquibase-migration-failed","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}