SonarQube Scanner for Jenkins 2.12: waitForQualityGate gives ProxyException

SonarQube Scanner for Jenkins 2.12 seems to introduce a defect whereby configuring sonar server URL (in Configure System) with a trailing slash causes waitForQualityGate to fail with ProxyException.

  • Tested using SonarQube EE 8.2 (and also with 8.3.1).
  • Using SonarQube Scanner for Jenkins 2.12. Previous versions have no error.
  • Jenkins is Jenkins 2.235.5
  • Both SonarQube and Jenkins employ Nginx 1.18.0 configured as reverse proxy.

There are no problems using the plugin in a normal Jenkins maven job. A multibranch pipeline job is also OK with performing the same task… uploading the analysis successfully to the sonarqube server.

The problem occurs with the waitForQualityGate step. The pipeline fails with:

hudson.remoting.ProxyException: net.sf.json.JSONException: Invalid JSON String
	at net.sf.json.JSONSerializer.toJSON(
	at net.sf.json.JSONSerializer.toJSON(
	at net.sf.json.JSONSerializer.toJSON(
	at hudson.plugins.sonar.client.WsClient.getCETask(
	at org.sonarsource.scanner.jenkins.pipeline.WaitForQualityGateStep$Execution.checkTaskCompleted(
	at org.sonarsource.scanner.jenkins.pipeline.WaitForQualityGateStep$Execution.start(
	at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(
	at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(
	at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(
	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(
	at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(
Caused: hudson.remoting.ProxyException: java.lang.IllegalStateException: Unable to parse response from
<!doctype html><html lang="en"><head><meta http-equiv="content-type" content="text/html; charset=UTF-8" (snip)

Note the URL following “Unable to parse response from”. It has an invalid “//” following the hostname. When I (eventually) spotted that then things were easy to fix.

Sonar URL was configured as:

Removing the trailing slash resolved the problem and all pipeline builds turned from sad to happy.

However, I do think that this is a defect as the trailing “/” has always worked up to now and it’s not invalid (is it?).

As an aside… I see that plugin 2.12 has not been release in JIRA and that the documentation SonarScanner for Jenkins is also out of date. The latter is also rather sparse. eg " click Add SonarQube , and add the values you’re prompted for." That’s not really that helpful… and the plugin itself is light on in-line help.


Same issue for me: the plugin developers should start to be more tolerant when upgrading and more cautious when introducing potentially breaking changes. The trailing slash was once required for the plugin to work, so going from required to breaking is absolutely nonsensical.


same here

same here

same here.

msymons I saw you said that “Removing the trailing slash resolved the problem and all pipeline builds turned from sad to happy.” how did you remove it? I have this stage

  stage("Quality Gate") {
        timeout(time: 1, unit: 'HOURS') {
          waitForQualityGate abortPipeline: true

and it automatically takes the wrong URL, I would like to remove the // but how can I do it?

In Jenkins: Dashboard → Manage Jenkins → Configure System → SonarQube installations.

Remove the trailing slash from the “Server URL” field.

1 Like

Thank you for saving my lifeeeee