ERROR: duplicate key value violates unique constraint "uniq_profile_rule_uuids"

Dear all,

Context

  • OS: linux debian 10 64 bits
  • Sonarqube: 8.7.14226
  • Java 11
  • DB postgresql

I’ve upgraded a sonarqube server from 8.4.1 to 8.7.14226 and I get a odd error at startup

2021.03.17 18:13:44 INFO  web[][o.s.s.q.RegisterQualityProfiles] Update profile flex/Sonar way
2021.03.17 18:13:44 ERROR web[][o.s.s.p.Platform] Background initialization failed. Stopping SonarQube
org.apache.ibatis.exceptions.PersistenceException: 
### Error updating database.  Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "uniq_profile_rule_uuids"
  Detail: Key (profile_uuid, rule_uuid)=(AXRsvw_PVoUU_xJRyb4-, 486) already exists.
### The error may exist in org.sonar.db.qualityprofile.ActiveRuleMapper
### The error may involve org.sonar.db.qualityprofile.ActiveRuleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: insert into active_rules (       uuid,       profile_uuid,       rule_uuid,       failure_level,       inheritance,       created_at,       updated_at     ) values (       ?,       ?,       ?,       ?,       ?,       ?,       ?     )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "uniq_profile_rule_uuids"
  Detail: Key (profile_uuid, rule_uuid)=(AXRsvw_PVoUU_xJRyb4-, 486) already exists.
	at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
...
Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "uniq_profile_rule_uuids"
  Detail: Key (profile_uuid, rule_uuid)=(AXRsvw_PVoUU_xJRyb4-, 486) already exists.

If a disabled sonar-flex-plugin-2.6.0.2294.jar by removing it, it’s OK.

I don’t need flex for our projects, but how to solve this problem in a standard way so I have not to repeat so for each update ?

Thank you.

Hi,

Welcome to the community!

This is probably about your upgrade procedure and the fact that from 8.5 we bundle analyzers as libraries. Did you copy the plugins from your old installation as part of your upgrade?

 
Ann