Sonarqube project import issue

I am using 8.9 Enterprise version of Sonarqube. I have both a prod and test environment for the work I need.
The thing I am trying to achieve is to split a big project into smaller ones, meaning that I will need my analysis data across all other smaller projects. The export-import part works fine for the first bit as long there isn’t an original on the server ( exporting the big project data, importing it into the first smaller one) I haven’t found a way to keep both projects on the same server. A lot of work was done into marking different issues and vulnerabilities which I don’t want gone by having a new project and start over .
I tried exporting with different keys and importing. My sonar is running in a dockerised linux container.
Is there a posibility to import the zip file without some of the files from the archive ? (like branches.rb or others where that key is being referenced ) or is there another way to get past this ? The main thing I care about are the marked sonar issues which I don’t want to lose. I am aware that future scans of the smaller projects will alter/remove some of them since they will be migrated to other projects but I want to keep all the sonar marked issues as the starting point for all of them.
This is the error I have when trying to import the zip file coming from the big base project sonar data:
I marked the actual uuid with * chars :

### Error updating database.  Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "pk_project_branches"
  Detail: Key (uuid)=(****************_***) already exists.
### The error may exist in org.sonar.db.component.BranchMapper
### The error may involve org.sonar.db.component.BranchMapper.insert-Inline
### The error occurred while setting parameters
### SQL: insert into project_branches (     uuid,     project_uuid,     kee,     branch_type,     merge_branch_uuid,     pull_request_binary,     created_at,     updated_at,     exclude_from_purge,     need_issue_sync     ) values (     ?,     ?,     ?,     ?,     ?,     ?,     ?,     ?,     ?,     ?     )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "pk_project_branches"
  Detail: Key (uuid)=(****************_***) already exists.
	at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(
	at org.apache.ibatis.session.defaults.DefaultSqlSession.update(
	at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(
	at org.apache.ibatis.binding.MapperMethod.execute(
	at org.apache.ibatis.binding.MapperProxy$PlainMethodInvoker.invoke(
	at org.apache.ibatis.binding.MapperProxy.invoke(
	at com.sun.proxy.$Proxy37.insert(Unknown Source)
	at org.sonar.db.component.BranchDao.insert(
	at com.sonar.governance.ce.H.B.A.execute(Unknown Source)
	at org.sonar.ce.task.step.ComputationStepExecutor.executeStep(
	at org.sonar.ce.task.step.ComputationStepExecutor.executeSteps(
	at org.sonar.ce.task.step.ComputationStepExecutor.execute(
	at com.sonar.governance.ce.H.B.A(Unknown Source)
	at com.sonar.governance.ce.H.A.A(Unknown Source)
	at com.sonar.governance.ce.C.A.A(Unknown Source)
	at com.sonar.governance.ce.C.A.process(Unknown Source)
	at org.sonar.ce.taskprocessor.CeWorkerImpl$ExecuteTask.executeTask(
	at org.sonar.ce.taskprocessor.CeWorkerImpl$
	at org.sonar.ce.taskprocessor.CeWorkerImpl.findAndProcessTask(
	at org.sonar.ce.taskprocessor.CeWorkerImpl$TrackRunningState.get(
	at java.base/java.util.concurrent.Executors$
	at java.base/
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(
	at java.base/java.util.concurrent.ThreadPoolExecutor$
	at java.base/
Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "pk_project_branches"
  Detail: Key (uuid)=(****************_***) already exists.
	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(
	at org.postgresql.core.v3.QueryExecutorImpl.execute(
	at org.postgresql.jdbc.PgStatement.executeInternal(
	at org.postgresql.jdbc.PgStatement.execute(
	at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(
	at org.postgresql.jdbc.PgPreparedStatement.execute(
	at org.apache.commons.dbcp2.DelegatingPreparedStatement.execute(
	at org.apache.commons.dbcp2.DelegatingPreparedStatement.execute(
	at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(
	at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(
	at org.apache.ibatis.executor.ReuseExecutor.doUpdate(
	at org.apache.ibatis.executor.BaseExecutor.update(
	at org.apache.ibatis.executor.CachingExecutor.update(
	at org.apache.ibatis.session.defaults.DefaultSqlSession.update(
	... 29 more"


Welcome to the community!

Your version is past EOL. You should upgrade to either the latest version or the current LTS at your earliest convenience. Your upgrade path is:

8.9.* → 9.9.4 → 10.4 (last step optional)

You may find these resources helpful:

If you have questions about upgrading, feel free to open a new thread for that here.

If your error persists after upgrade, please come back to us.


Thank you for the reply Ann. I will perform the upgrade on the sonar test instance and see how it goes and get back to you .

1 Like