Error 500 when trying to create project that exists already (instead of 400) After upgrade to 9.7.1


We have some automation to provision our SQ Enterprise instance (automate creating project).

Since upgrade from Enterprise from 9.6 to 9.7.1 we got 500 errors (instead of 400) when we try to create a project with an existing key. (It only happens when project has data).

It’s not mega user friendly and raise error on SQ logs.

This is the stacktrace we have

2022.11.25 05:23:17 ERROR web[AYRlG4F28z1KNFNoBkbM][o.s.s.w.WebServiceEngine] Fail to process request http://****/api/projects/create?name=*****&project=****&visibility=private

org.apache.ibatis.exceptions.TooManyResultsException: Expected one result (or null) to be returned by selectOne(), but found: 59
113891at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(
113892at org.apache.ibatis.binding.MapperMethod.execute(
113893at org.apache.ibatis.binding.MapperProxy$PlainMethodInvoker.invoke(
113894at org.apache.ibatis.binding.MapperProxy.invoke(

What’s going on here ?



1 Like

Hey there.

Thanks for the report! Take a look at this thread – I’m pretty sure it’s the same issue (and will get fixed a release coming soon)

1 Like

Hi @Colin

Sadly even after upgrading to 9.9 latest LTS I have 500 error when trying to create existing projects.

2023.02.21 11:11:58 ERROR web[AYZygfWvqRRm9qF8AElH][o.s.s.w.WebServiceEngine] Fail to process request http://*******/api/projects/create?name=*******&project=P*******&visibility=private
org.apache.ibatis.exceptions.TooManyResultsException: Expected one result (or null) to be returned by selectOne(), but found: 2
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(
at org.apache.ibatis.binding.MapperMethod.execute(
at org.apache.ibatis.binding.MapperProxy$PlainMethodInvoker.invoke(
at org.apache.ibatis.binding.MapperProxy.invoke(
at jdk.proxy2/jdk.proxy2.$Proxy89.selectByKeyCaseInsensitive(Unknown Source)
at org.sonar.db.component.ComponentDao.selectByKeyCaseInsensitive(
at org.sonar.server.component.ComponentUpdater.checkKeyAlreadyExists(
at org.sonar.server.component.ComponentUpdater.createWithoutCommit(
at org.sonar.server.component.ComponentUpdater.create(
at org.sonar.server.platform.web.WebServiceFilter.doFilter(
at org.sonar.server.platform.web.MasterServletFilter$GodFilterChain.doFilter(
at org.sonar.server.platform.web.SonarLintConnectionFilter.doFilter(
at org.sonar.server.platform.web.MasterServletFilter$GodFilterChain.doFilter(
at org.sonar.server.platform.web.MasterServletFilter.doFilter(
at jdk.internal.reflect.GeneratedMethodAccessor21.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at java.base/ Source)



Hi @jonesbusy,

Thanks for providing the logs.

It seems to be the same issue with the one that is supposed to be fixed.
I wasn’t able to reproduce the issue on the 9.9 LTS version. I tried with multiple existing projects, with data and branches, and all of them returned 400 Bad Request responses with the appropriate error message when the key already exists.

Can you check on your side if you get the 500 response on other projects too?

Hi @dimitris.kavvathas

Thanks for your answer. No it seems to happen with only a subset of projects. Doesn’t happen in our staging environment without any analyzing data.

I’m happy to help you debug (maybe provide me a SQL query to run on our DB for the project that is causing issue).

We are using the SonarQube official helm chart (latest version) with latest LTS.

We upgraded every version from 9.6 to 9.9.

Not sure if it helps.


Hello @jonesbusy,

Thanks for offering to help.

In order to debug, I’ll need some information from the components database table.
I have sent you a private message for more information.


Thanks @dimitris.kavvathas

I’ve provided necessary information on private message.

Best regards,


With the data provided by @jonesbusy we managed to reproduce the issue.
I created a bug ticket to track its progress.

Thanks again @jonesbusy for helping us identify the problem! :smiley:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.