Sonarqube upgrade error 9.9 to 24.12. Help Needed

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube Server / Community Build, Scanner, Plugin, and any relevant extension)

  • how is SonarQube deployed: Helm Chart

  • what are you trying to achieve : Upgrading from 9.9 to 24.12

  • what have you tried so far to achieve this

    Team,
    I am attempting to upgrade our SonarQube instance from version 9.9 (Community Edition) to 24.12, following the official upgrade documentation. The application is deployed using Docker and Helm, with a PostgreSQL database backend (which is compatible with 24.12).

    During the upgrade, SonarQube fails at the database migration step, specifically when migrating data. Here are the relevant error messages from the logs:

    Error Log:
    2025.11.24 15:58:29 ERROR web[o.s.s.p.d.m.v.v.AbstractMigrateLiveMeasuresToMeasures] Migration of branch AYvZzfiG2C5kTFPXP1NQ failed
    2025.11.24 15:58:29 ERROR web[DbMigrations] 1/24 #108003 ‘Migrate the content of ‘live_measures’ to ‘measures’ for branches’: failure | time=134ms
    2025.11.24 15:58:29 ERROR web[DbMigrations] Executed 0/24 DB migrations: failure | time=135ms
    2025.11.24 15:58:29 ERROR web[o.s.s.p.d.m.DatabaseMigrationImpl] DB migration failed | time=157ms
    2025.11.24 15:58: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 #108003 ‘Migrate the content of ‘live_measures’ to ‘measures’ for branches’ failed
    at org.sonar.server.platform.db.migration.step.MigrationStepsExecutorImpl.execute(MigrationStepsExecutorImpl.java:112)
    at org.sonar.server.platform.db.migration.step.MigrationStepsExecutorImpl.execute(MigrationStepsExecutorImpl.java:97)
    at org.sonar.server.platform.db.migration.step.MigrationStepsExecutorImpl.execute(MigrationStepsExecutorImpl.java:70)
    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:1136)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.base/java.lang.Thread.run(Thread.java:840)
    Caused by: java.lang.IllegalStateException: Error during processing of row: [component_uuid=AYvZzf_1tm_LO8pcuMCf,name=file_complexity,val_type=FLOAT,value=1.00000000000000000000,text_value=null,measure_data=null]
    at org.sonar.server.platform.db.migration.step.SelectImpl.newExceptionWithRowDetails(SelectImpl.java:89)
    at org.sonar.server.platform.db.migration.step.SelectImpl.scroll(SelectImpl.java:81)
    at org.sonar.server.platform.db.migration.step.MassUpdate.execute(MassUpdate.java:93)
    at org.sonar.server.platform.db.migration.version.v108.AbstractMigrateLiveMeasuresToMeasures.migrateItem(AbstractMigrateLiveMeasuresToMeasures.java:146)
    at org.sonar.server.platform.db.migration.version.v108.AbstractMigrateLiveMeasuresToMeasures.execute(AbstractMigrateLiveMeasuresToMeasures.java:124)
    at org.sonar.server.platform.db.migration.step.DataChange.execute(DataChange.java:44)
    at org.sonar.server.platform.db.migration.step.MigrationStepsExecutorImpl.execute(MigrationStepsExecutorImpl.java:108)
    … 8 common frames omitted
    Caused by: java.sql.BatchUpdateException: Batch entry 0 insert into measures (component_uuid, branch_uuid, json_value, json_value_hash, created_at, updated_at)
    values ( (‘AY-g4Gu_U86kxpPF0297’), (‘AYvZzfiG2C5kTFPXP1NQ’), (‘{“complexity”:3.0,“new_development_cost”:1230.0,“functions”:3.0,“classes”:1.0,“new_coverage”:100.0,“statements”:4.0,“new_duplicated_blocks”:0.0,“sqale_rating”:1.0,“ncloc_data”:“1\u003d1;3\u003d1;4\u003d1;5\u003d1;6\u003d1;7\u003d1;8\u003d1;10\u003d1;11\u003d1;12\u003d1;13\u003d1;15\u003d1;16\u003d1;17\u003d1;19\u003d1;20\u003d1;21\u003d1;24\u003d1;25\u003d1;26\u003d1;27\u003d1;29\u003d1;30\u003d1;31\u003d1;32\u003d1;33\u003d1;34\u003d1;36\u003d1;37\u003d1;39\u003d1;41\u003d1;42\u003d1;43\u003d1;44\u003d1;45\u003d1;46\u003d1;47\u003d1;48\u003d1;49\u003d1;50\u003d1;52\u003d1”,“new_line_coverage”:100.0,“lines_to_cover”:13.0,“ncloc”:40.0,“new_conditions_to_cover”:0.0,“line_coverage”:100.0,“executable_lines_data”:“32\u003d1;48\u003d1;39\u003d1;41\u003d1;26\u003d1;42\u003d1;27\u003d1;44\u003d1;46\u003d1;31\u003d1;47\u003d1”,“lines”:52.0,“coverage”:100.0,“reliability_rating”:1.0,“ncloc_language_distribution”:“java\u003d40”,“new_lines”:52.0,“security_rating”:1.0,“development_cost”:“1200”,“comment_lines_density”:2.4,“new_uncovered_conditions”:0.0,“security_review_rating”:1.0,“new_duplicated_lines”:0.0,“comment_lines”:1.0,“uncovered_lines”:0.0,“files”:1.0,“new_uncovered_lines”:0.0,“last_commit_date”:1.717601097E12,“new_lines_to_cover”:13.0,“new_duplicated_lines_density”:0.0,“file_complexity”:3.0}’), (‘-7855643415340686545’::int8), (‘1764017909821’::int8), (‘1764017909821’::int8))
    was aborted: ERROR: duplicate key value violates unique constraint “pk_measures”
    Detail: Key (component_uuid)=(AY-g4Gu_U86kxpPF0297) already exists. Call getNextException to see other errors in the batch.
    at org.postgresql.jdbc.BatchResultHandler.handleError(BatchResultHandler.java:165)
    at org.postgresql.core.ResultHandlerDelegate.handleError(ResultHandlerDelegate.java:52)
    at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2421)
    at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:580)
    at org.postgresql.jdbc.PgStatement.internalExecuteBatch(PgStatement.java:888)
    at org.postgresql.jdbc.PgStatement.executeBatch(PgStatement.java:912)
    at org.postgresql.jdbc.PgPreparedStatement.executeBatch(PgPreparedStatement.java:1739)
    at com.zaxxer.hikari.pool.ProxyStatement.executeBatch(ProxyStatement.java:127)
    at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeBatch(HikariProxyPreparedStatement.java)
    at org.sonar.server.platform.db.migration.step.UpsertImpl.addBatch(UpsertImpl.java:56)
    at org.sonar.server.platform.db.migration.step.MassUpdate.callSingleHandler(MassUpdate.java:120)
    at org.sonar.server.platform.db.migration.step.MassUpdate.lambda$execute$0(MassUpdate.java:93)
    at org.sonar.server.platform.db.migration.step.SelectImpl.scroll(SelectImpl.java:78)
    … 13 common frames omitted
    Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint “pk_measures”
    Detail: Key (component_uuid)=(AY-g4Gu_U86kxpPF0297) already exists.
    at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2733)
    at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2420)

Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!

Hey there.

I believe we saw these failures when the migration started and did not successfully finish all in one-go. Do you have a backup of 9.9 you can restore to?