Unable to run Sonar Scanner - SonarQube server [localhost:9005] can not be reached

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
  • what are you trying to achieve
  • what have you tried so far to achieve this

which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension) : Sonar Version - 8.4.2 & Scanner Version - 4.4.0

what are you trying to achieve : Trying to run Scanner. But got the below error.

ERROR: SonarQube server [localhost:9005] can not be reached
INFO: ------------------------------------------------------------------------
INFO: ------------------------------------------------------------------------
INFO: Total time: 0.317s
INFO: Final Memory: 2M/14M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarScanner execution
org.sonarsource.scanner.api.internal.ScannerException: Unable to execute SonarScanner analysis
at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.lambda$createLauncher$0(IsolatedLauncherFactory.java:85)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:74)
at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:70)
at org.sonarsource.scanner.api.EmbeddedScanner.doStart(EmbeddedScanner.java:185)
at org.sonarsource.scanner.api.EmbeddedScanner.start(EmbeddedScanner.java:123)
at org.sonarsource.scanner.cli.Main.execute(Main.java:73)
at org.sonarsource.scanner.cli.Main.main(Main.java:61)
Caused by: java.lang.IllegalStateException: Fail to get bootstrap index from server
at org.sonarsource.scanner.api.internal.BootstrapIndexDownloader.getIndex(BootstrapIndexDownloader.java:42)
at org.sonarsource.scanner.api.internal.JarDownloader.getScannerEngineFiles(JarDownloader.java:58)
at org.sonarsource.scanner.api.internal.JarDownloader.download(JarDownloader.java:53)
at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.lambda$createLauncher$0(IsolatedLauncherFactory.java:76)
… 7 more
Caused by: java.lang.IllegalArgumentException: Expected URL scheme ‘http’ or ‘https’ but no colon was found
at org.sonarsource.scanner.api.internal.shaded.okhttp.HttpUrl$Builder.parse(HttpUrl.java:1332)
at org.sonarsource.scanner.api.internal.shaded.okhttp.HttpUrl.get(HttpUrl.java:917)
at org.sonarsource.scanner.api.internal.shaded.okhttp.Request$Builder.url(Request.java:165)
at org.sonarsource.scanner.api.internal.ServerConnection.callUrl(ServerConnection.java:110)
at org.sonarsource.scanner.api.internal.ServerConnection.downloadString(ServerConnection.java:99)
at org.sonarsource.scanner.api.internal.BootstrapIndexDownloader.getIndex(BootstrapIndexDownloader.java:39)
… 10 more
ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.

what have you tried so far to achieve this : Updated Scanner properties file with “sonar.host.url=localhost:9005”.

Please help me to resolve this issue.

Thanks and Regards,

Hello Raj,

welcome to the community!

Have a look at this message here:

So try to add http:// in front of the URL, this should resolve it.

1 Like

Hi Hendrik,

Thanks for your suggestion. I used the below script to run the scanner. But no luck. Got the same error.

sonar-scanner.bat -D"sonar.projectKey=bw5" -D"sonar.sources=." -D"sonar.host.url=http:\" -D"sonar.login=f16e41c33065b45b15d872a67181cf5bafcfb5ae" -D"sonar.log.console=true" -D"sonar.projectBaseDir=C:\Vodafone\Work\BW_Project\Test

Please advice.

Thanks and Regards,

Hi Raj,

the URL does not look correct. You have to use 2 forward slashes instead of one backward slash (

The sonar.login token is a sensitive key, I would consider revoking it and creating a new one as it is public now.

Best regards,

Hi Hendrik,

Many thanks for your help.

Sorry. It’s not working in either way. Getting the same error message. I changed port number from 9005 to 9006. But no luck.

ERROR: SonarQube server [http:\localhost:9006] can not be reached
ERROR: SonarQube server [http://localhost:9006] can not be reached

Please advice.

Thanks and Regards,

I kept two backward slashes while testing. It is appearing as single backslash only when I copy the full error message here.