Failed to Upload Report

Hello,

We’re running version 9.9.0.65466 of SonarQube and using it to analyze and decorate PRs on a mono repo. Recently we started the following error (more details below):

ERROR: Error during SonarScanner execution
java.lang.IllegalStateException: Failed to upload report: Fail to request url

The error only occurs on our main branch (which is the only branch that scans the whole repo).
Any help solving this would be appreciated :slight_smile:

Full error:

INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 27:18.483s
INFO: Final Memory: 2922M/4096M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarScanner execution
java.lang.IllegalStateException: Failed to upload report: Fail to request url: https://[sonarqube url].com/api/ce/submit?projectKey=...
	at org.sonar.scanner.report.ReportPublisher.upload(ReportPublisher.java:226)
	at org.sonar.scanner.report.ReportPublisher.execute(ReportPublisher.java:154)
	at org.sonar.scanner.scan.SpringProjectScanContainer.doAfterStart(SpringProjectScanContainer.java:376)
	at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
	at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
	at org.sonar.scanner.bootstrap.SpringGlobalContainer.doAfterStart(SpringGlobalContainer.java:137)
	at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
	at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
	at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)
	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)
	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
	at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
	at com.sun.proxy.$Proxy0.execute(Unknown Source)
	at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
	at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
	at org.sonarsource.scanner.cli.Main.main(Main.java:61)
Caused by: java.lang.IllegalStateException: Fail to request url: https://[sonarqube url].com/api/ce/submit?projectKey=...
	at org.sonarqube.ws.client.HttpConnector.doCall(HttpConnector.java:208)
	at org.sonarqube.ws.client.HttpConnector.post(HttpConnector.java:158)
	at org.sonarqube.ws.client.HttpConnector.call(HttpConnector.java:115)
	at org.sonar.scanner.bootstrap.DefaultScannerWsClient.call(DefaultScannerWsClient.java:87

Hey there.

Is the request actually making it to the SonarQube server – or is it possibly being halted in between (by whatever is serving your SonarQube server over HTTPS, like IIS, Nginx, Apache…)?

You can check your SonarQube server’s access logs (/logs/access.log) to find (or not) the request.

I do see the request in the access logs:

127.0.0.1 - - [27/Jul/2023:15:43:44 +0000] "POST /api/ce/submit?projectKey=[...]- HTTP/1.0" 200 44 "-" "ScannerNpm/3.0.0" "AYkhi55RI1GSbpYlLnyp"

Well then, it looks like as far as SonarQube is concerned, the request is successful (assuming you’re sure it’s the same POST api/ce/submit call).

Do you see any logs about the failure in the “in-between” layer? As noted earlier, whatever is serving your SonarQube server over HTTPS, like IIS, Nginx, Apache…)