Database upgrade failing with below error when upgrading SonarQube from 8.9.6 to 9.7.1

We are upgrading SonarQube community edition from 8.9.6 to 9.7.1. The server started up fine and we saw the below line at the end of sonar.log

2022.12.21 09:56:36 WARN  app[][startup] ################################################################################
2022.12.21 09:56:36 WARN  app[][startup] The database must be manually upgraded. Please backup the database and browse /setup. For more information: https://docs.sonarqube.org/latest/setup/upgrading
2022.12.21 09:56:36 WARN  app[][startup] ################################################################################

Opened the link /setup and clicked on upgrade. The upgrade ran for a minute and server got stopped. The logs in web.log show below errors. What could be the cause and resolution.

 2022.12.21 10:02:47 WARN  web[][o.s.a.s.w.WebService$Action] The response example is not set on action saml/validation_init
2022.12.21 10:02:47 WARN  web[][o.s.a.s.w.WebService$Action] The response example is not set on action api/system/liveness
2022.12.21 10:02:47 WARN  web[][o.s.a.s.w.WebService$Action] The response example is not set on action api/plugins/download
2022.12.21 10:02:47 WARN  web[][o.s.a.s.w.WebService$Action] The response example is not set on action api/analysis_cache/get
2022.12.21 10:02:47 WARN  web[][o.s.a.s.w.WebService$Action] The response example is not set on action api/alm_integrations/check_pat
2022.12.21 10:02:47 WARN  web[][o.s.c.a.AnnotationConfigApplicationContext] Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jdk.internal.loader.ClassLoaders$AppClassLoader@77556fd-org.sonar.server.ws.WebServiceEngine': Initialization of bean failed; nested exception is java.lang.IllegalStateException: The action 'create_bitbucketcloud' is defined multiple times in the web service 'api/alm_settings'
2022.12.21 10:02:47 ERROR web[][o.s.s.p.Platform] Background initialization failed. Stopping SonarQube
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jdk.internal.loader.ClassLoaders$AppClassLoader@77556fd-org.sonar.server.ws.WebServiceEngine': Initialization of bean failed; nested exception is java.lang.IllegalStateException: The action 'create_bitbucketcloud' is defined multiple times in the web service 'api/alm_settings'
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:628)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:955)
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583)
	at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:187)
	at org.sonar.server.platform.platformlevel.PlatformLevel.start(PlatformLevel.java:80)
	at org.sonar.server.platform.platformlevel.PlatformLevel4.start(PlatformLevel4.java:647)
	at org.sonar.server.platform.PlatformImpl.start(PlatformImpl.java:196)
	at org.sonar.server.platform.PlatformImpl.startLevel34Containers(PlatformImpl.java:177)
	at org.sonar.server.platform.PlatformImpl$1.lambda$doRun$0(PlatformImpl.java:105)
	at org.sonar.server.platform.PlatformImpl$AutoStarterRunnable.runIfNotAborted(PlatformImpl.java:344)
	at org.sonar.server.platform.PlatformImpl$1.doRun(PlatformImpl.java:105)
	at org.sonar.server.platform.PlatformImpl$AutoStarterRunnable.run(PlatformImpl.java:328)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.IllegalStateException: The action 'create_bitbucketcloud' is defined multiple times in the web service 'api/alm_settings'
	at org.sonar.api.server.ws.WebService$NewController.createAction(WebService.java:177)
	at com.github.mc1arke.sonarqube.plugin.server.pullrequest.ws.action.CreateAction.define(CreateAction.java:44)
	at com.github.mc1arke.sonarqube.plugin.server.pullrequest.ws.action.CreateAction.define(CreateAction.java:29)
	at org.sonar.server.almsettings.ws.AlmSettingsWs.lambda$define$0(AlmSettingsWs.java:38)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1540)
	at org.sonar.server.almsettings.ws.AlmSettingsWs.define(AlmSettingsWs.java:38)
	at org.sonar.server.ws.WebServiceEngine.start(WebServiceEngine.java:76)
	at org.sonar.core.platform.StartableBeanPostProcessor.postProcessBeforeInitialization(StartableBeanPostProcessor.java:33)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:440)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1796)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620)
	... 18 common frames omitted
2022.12.21 10:02:47 DEBUG web[][o.s.s.p.Platform] Background initialization of SonarQube done
2022.12.21 10:02:47 INFO  web[][o.s.p.ProcessEntryPoint] Hard stopping process

Thanks in advance

It looks like you’re using a plugin that tries to enable branch analysis on the Community Edition of SonarQube – which causes a failure. I would recommend uninstalling it from your SonarQube instance – we won’t be able to provide support for it here.