Quality Gate failed: Could not fetch quality gate status: b'{"errors":[{"msg":"Analysis with id \\

Hello,

By any chance was there any renaming of the main branch in your repository?

Hi,

No, all branch names are unique.

Hi @Emvigo

I’m really sorry for the late reply.

We have a hipothesis of where the issue may come from. In order to confirm it could you answer the following questions:

  • what’s the name of your main branch?
  • have you made any changes to your pipeline when the issue appeared?
  • what’s the exact date when the issue appeared?

Anita

We are Currently facing the same issue as mentioned above.

Was the problem within this topic resolved?
if so could you share the solution, as i don’t see any solution in this topic?

Thanks
Edwin

Hi @EdwinvandenBos

Welcome to the community!

Could you create a new thread as per our guidelines? This will allow us to triage it :slight_smile:
Please, link this thread though, as possibly related.

Anita

For any stumbling into this post with the same issue, we did find a workaround. Please visit this other thread:

hi, I also facing the same issue just today (23 Aug 2024). It was ok before.
here is the information:
sonarqube : Community Edition v10.5.1 (90531)
jenkins: 2.462.1
sonarqube plugin : SonarQube Scanner for Jenkins Version 2.17.2
java: openjdk 17.0.12 2024-07-16

Hi @Eko_Budiharto,
Did you try the workaround from the other thread?

1 Like

hi @eric.giffon ,
I did read other threads and here are what I have done to try already:

  1. I re-generated the sonarqube token and put the new token in jenkins
  2. I also create another pipeline with the new token
  3. I also try to use sonarqube webhooks.
  4. I also try to use “Sonar Quality Gates” jenkins plugin

So far, I still have the same error message. Here is the error message:
10:42:17 Checking status of SonarQube task ‘47f75014-484c-49d8-8a3d-853d2749d922’ on server ‘sonar-installation’
10:42:17 SonarQube task ‘47f75014-484c-49d8-8a3d-853d2749d922’ status is ‘SUCCESS’ 10:42:17 [Pipeline] }
10:42:17 [Pipeline] // script
10:42:17 [Pipeline] }
10:42:17 [Pipeline] // timeout
10:42:17 [Pipeline] }
10:42:17 [Pipeline] // stage
10:42:17 [Pipeline] }
10:42:17 [Pipeline] // withEnv
10:42:17 [Pipeline] }
10:42:17 [Pipeline] // node
10:42:17 [Pipeline] End of Pipeline
10:42:17 Also: org.jenkinsci.plugins.workflow.actions.ErrorAction$ErrorId: 800cedfd-4b5d-4d1c-beed-d63662f8b6dc
10:42:17 org.sonarqube.ws.client.HttpException: Error 404 on host/api/qualitygates/project_status?analysisId=62b4f02c-e2fe-47e7-a4e6-217efec343f9 : {“errors”:[{“msg”:“Analysis with id \u002762b4f02c-e2fe-47e7-a4e6-217efec343f9\u0027 is not found”}]}

and here is my script:

     stage ('Code Quality Scan') {
           steps {
                withSonarQubeEnv('sonar-installation') {
                    sh '''#!/bin/bash
                        cd $PROJECT_NAME
                        pwd
                        $MAVEN_HOME/bin/mvn clean package sonar:sonar
                    '''
                }
            }
        } 
        
        stage("Quality Gate") {
            steps {
                echo 'Quality Gate'
                
                timeout(time: 1, unit: 'HOURS') {
                    script {
                        def qg = waitForQualityGate()  
                        if (qg.status == 'OK') {
                            error "Pipeline aborted due to quality gate failure: ${qg.status}"
                        }
                    }
                }
            }
        }

I have a thought, I could be wrong. Does sonarqube and/or jenkins has a cache for every jenkins job run? because I am afraid whatever i do, I get the same result because the cache.

Hello,
This issue is not related to the original post of this thread. Can you please create another topic?
But to answer your question, no, there shouldn’t be any cache for Jenkins jobs.

1 Like