Context: Stack Overflow #42909439 (accepted answer, 14 votes): a Jenkins declarative pipeline fails at waitForQualityGate with "SonarQube installation defined in this job does not match any configured installation". The asker renamed the server in Jenkins config to match the Jenkinsfile and got a different error; the thread found the real cause in the scanner plugin.

[accepted answer]: two things to check. First, the name passed to withSonarQubeEnv in the Jenkinsfile must exactly match a server name configured under Jenkins global SonarQube servers; a mismatch produces the "does not match any configured installation" error. Second, there was a genuine bug in the SonarQube Jenkins scanner plugin (tracked as SONARJNKNS-282): waitForQualityGate failed when the job ran on a Jenkins agent/slave instead of the master. The fix was upgrading to scanner plugin v2.61 or newer. A working stage looks like this:

stage("SonarQube analysis") { steps { withSonarQubeEnv("YourServerName") { sh "[path-to]/sonar-scanner" } def qg = waitForQualityGate() if (qg.status != "OK") { error "Pipeline aborted due to quality gate failure" } } }

If waitForQualityGate fails only on agents but works on the master, it is the plugin bug: upgrade, dont rename things.