Quality gate is giving org.sonarqube.ws.client.HttpException:

we are using SonarQube community edition but we are getting quality gate error because it is taking different task id. Below is the one

Checking status of SonarQube task 'AX-5xC_YGWcwZoeE6tg8' on server 'sonar-ee'
SonarQube task 'AX-5xC_YGWcwZoeE6tg8' status is 'SUCCESS'

Quality gate:
[analysisId=AX-5xDfzHlUrrA8axMqh](https://sonar-ee.intra.infineon.com/api/qualitygates/project_status?analysisId=AX-5xDfzHlUrrA8axMqh) : {"errors":[{"msg":"Analysis with id 'AX-5xDfzHlUrrA8axMqh' is not found"}]}

below is the complete Jenkins file

steps {
    withSonarQubeEnv('sonar-ee'){   //Sonarqube server name configured in Jenkins
    bat """    
                dotnet --version
                dotnet ${sonarms}\\SonarScanner.MSBuild.dll begin -d:sonar.qualitygate.wait=true /k:${sq_project_key} /n:${sq_project_name}
                dotnet build BookLibrary.aspnetcore.sln
                dotnet ${sonarms}\\SonarScanner.MSBuild.dll end
		 stage('Quality Gate'){  // this should be enabled in conjunction with SonarQube Webhooks
            steps {
                timeout(time: 1, unit: 'HOURS') { // Just in case something goes wrong, pipeline will be killed after a timeout
                    script {
                        waitForQualityGate abortPipeline: true


Welcome to the community!

You’re using Jenkins, so there’s a better way of going about this.