Uploaded image for project: 'SonarQube'
  1. SonarQube
  2. SONAR-12843

Error 500 when creating an Application branch name that already exist

    XMLWordPrintable

    Details

    • Edition:
      Enterprise
    • Production Notes:
      None

      Description

      How to reproduce

      1. Create an Application
      2. Create a branch on this application
      3. Create a branch with the same name on this application
      4. The red message "An error has occurred. Please contact your administrator" appear, whereas I would have expect an explicit message saying that this branch name already exists. 

      Here are the logs from web.log : 

      2019.12.16 17:43:01 ERROR web[AW8PExjyC4A0Nh3xAAC1][o.s.s.w.WebServiceEngine] Fail to process request http://jl.eu.ngrok.io/api/applications/create_branch2019.12.16 17:43:01 ERROR web[AW8PExjyC4A0Nh3xAAC1][o.s.s.w.WebServiceEngine] Fail to process request http://jl.eu.ngrok.io/api/applications/create_branchorg.apache.ibatis.exceptions.PersistenceException: ### Error updating database.  Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "projects_kee"  Detail: Key (kee)=(test3:BRANCH:branch1) already exists.### The error may exist in org.sonar.db.component.ComponentMapper### The error may involve org.sonar.db.component.ComponentMapper.insert-Inline### The error occurred while setting parameters### SQL: INSERT INTO projects (       organization_uuid,       kee,       uuid,       uuid_path,       project_uuid,       module_uuid,       module_uuid_path,       main_branch_project_uuid,       name,       long_name,       qualifier,       scope,       language,       description,       private,       tags,       root_uuid,       path,       copy_component_uuid,       enabled,       created_at,       b_changed,       deprecated_kee,       b_copy_component_uuid,       b_description,       b_enabled,       b_language,       b_long_name,       b_module_uuid,       b_module_uuid_path,       b_name,       b_path,       b_qualifier     )     VALUES (     ?,     ?,     ?,     ?,     ?,     ?,     ?,     ?,     ?,     ?,     ?,     ?,     ?,     ?,     ?,     ?,     ?,     ?,     ?,     ?,     ?,     false,     null,     null,     null,     false,     null,     null,     null,     null,     null,     null,     null     )### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "projects_kee"  Detail: Key (kee)=(test3:BRANCH:branch1) already exists. at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30) at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:199) at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:184) at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:62) at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:93) at com.sun.proxy.$Proxy60.insert(Unknown Source) at org.sonar.db.component.ComponentDao.insert(ComponentDao.java:367) at com.sonar.governance.views.ViewsDbUpdater.createApplicationBranchImpl(ViewsDbUpdater.java:136) at com.sonar.governance.views.ViewsDbUpdater.createApplicationBranch(ViewsDbUpdater.java:119) at com.sonar.governance.application.ws.CreateBranchAction.handle(CreateBranchAction.java:81) at org.sonar.server.ws.WebServiceEngine.execute(WebServiceEngine.java:110) at org.sonar.server.platform.web.WebServiceFilter.doFilter(WebServiceFilter.java:88) at org.sonar.server.platform.web.MasterServletFilter$GodFilterChain.doFilter(MasterServletFilter.java:139) at org.sonar.server.platform.web.MasterServletFilter.doFilter(MasterServletFilter.java:108) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.sonar.server.platform.web.UserSessionFilter.doFilter(UserSessionFilter.java:88) at org.sonar.server.platform.web.UserSessionFilter.doFilter(UserSessionFilter.java:72) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.sonar.server.platform.web.CacheControlFilter.doFilter(CacheControlFilter.java:76) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.sonar.server.platform.web.SecurityServletFilter.doHttpFilter(SecurityServletFilter.java:76) at org.sonar.server.platform.web.SecurityServletFilter.doFilter(SecurityServletFilter.java:48) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.sonar.server.platform.web.RedirectFilter.doFilter(RedirectFilter.java:58) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.sonar.server.platform.web.RequestIdFilter.doFilter(RequestIdFilter.java:66) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.sonar.server.platform.web.RootFilter.doFilter(RootFilter.java:62) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:109) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81) at ch.qos.logback.access.tomcat.LogbackValve.invoke(LogbackValve.java:256) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:798) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:808) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.base/java.lang.Thread.run(Thread.java:834)Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "projects_kee"  Detail: Key (kee)=(test3:BRANCH:branch1) already exists. at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2497) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2233) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:310) at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:446) at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:370) at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:149) at org.postgresql.jdbc.PgPreparedStatement.execute(PgPreparedStatement.java:138) at org.apache.commons.dbcp2.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:94) at org.apache.commons.dbcp2.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:94) at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:47) at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:74) at org.apache.ibatis.executor.ReuseExecutor.doUpdate(ReuseExecutor.java:52) at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117) at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:76) at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:197) ... 54 common frames omitted
      
      

       

        Attachments

          Activity

            People

            Assignee:
            jacek.poreda Jacek Poreda
            Reporter:
            julien.lancelot Julien Lancelot
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Due:
              Created:
              Updated:
              Resolved: