SonarQube Community Edition 26.1 Docker Image with posgresql DB as backend Fails Migration

SonarQube Community Edition 26.1 Docker Image with posgresql DB as backend Fails Migration …

The error is

sonar DB migration failed | time=97ms 2026.01.07 02:33:29 ERROR web\[\]\[o.s.s.p.d.m.DatabaseMigrationImpl\] DB migration ended with an exception org.sonar.server.platform.db.migration.step.MigrationStepExecutionException: Execution of migration step #202506027 'Add 'part_number' column to 'ce_task_input'' failed at org.sonar.server.platform.db.migration.step.MigrationStepsExecutorImpl.execute(MigrationStepsExecutorImpl.java:105)
    at org.sonar.server.platform.db.migration.step.MigrationStepsExecutorImpl.execute(MigrationStepsExecutorImpl.java:89)
    at org.sonar.server.platform.db.migration.step.MigrationStepsExecutorImpl.execute(MigrationStepsExecutorImpl.java:66)
    at org.sonar.server.platform.db.migration.engine.MigrationEngineImpl.execute(MigrationEngineImpl.java:55)
    at org.sonar.server.platform.db.migration.DatabaseMigrationImpl.doUpgradeDb(DatabaseMigrationImpl.java:106)
    at org.sonar.server.platform.db.migration.DatabaseMigrationImpl.doDatabaseMigration(DatabaseMigrationImpl.java:81)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
    at java.base/java.lang.Thread.run(Thread.java:1583) Caused by: java.lang.IllegalStateException: Fail to execute ALTER TABLE ce_task_input DROP CONSTRAINT ce_task_input_task_uuid_not_null at org.sonar.server.platform.db.migration.step.DdlChange$ContextImpl.execute(DdlChange.java:106)
    at org.sonar.server.platform.db.migration.step.DdlChange$ContextImpl.execute(DdlChange.java:86)
    at org.sonar.server.platform.db.migration.step.DdlChange$ContextImpl.execute(DdlChange.java:128)
    at org.sonar.server.platform.db.migration.version.v202506.AddPartNumberColumnToCeTaskInputTable.execute(AddPartNumberColumnToCeTaskInputTable.java:57)
    at org.sonar.server.platform.db.migration.step.DdlChange.execute(DdlChange.java:45)
    at org.sonar.server.platform.db.migration.step.MigrationStepsExecutorImpl.execute(MigrationStepsExecutorImpl.java:101) 
    ... 8 common frames omitted 
Caused by: org.postgresql.util.PSQLException: ERROR: column "task_uuid" is in a primary key at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2736)
    at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2421)
    at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:372)
    at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:525)
    at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:435)
    at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:357)
    at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:342)
    at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:318)
    at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:313)
    at com.zaxxer.hikari.pool.ProxyStatement.execute(ProxyStatement.java:95)
    at com.zaxxer.hikari.pool.HikariProxyStatement.execute(HikariProxyStatement.java)
    at org.sonar.server.platform.db.migration.step.DdlChange$ContextImpl.execute(DdlChange.java:91) 
    ... 13 common frames omitted

Hi,

Welcome to the community!

It looks like you’re trying to use Postgres 18. That’s not supported yet. If you’ll downgrade to Postgres 17 this should work for you.

 
HTH,
Ann