HTTP FAILED: java.net.SocketTimeoutException: Connect timed out

I was able to scan my project using SonarQube scanner in my local and able to submit the report to the private community build SonarQube server without any issues.

While I was setting up the same using GitHub actions, I got stuck.
I followed the official documentation for setting up the Sonar scanner using GitHub actions.

Here’s the details of the SonarQube server and scanner versions:
Private Community Build v25.1.0.102122
SonarScanner CLI 7.1.0.4889

Here’s the error details from GitHub actions:

14:00:59.597 INFO  SonarScanner CLI 7.1.0.4889
14:00:59.599 INFO  Java 17.0.13 Eclipse Adoptium (64-bit)
14:00:59.599 INFO  Linux 6.11.0-1015-azure amd64
14:00:59.606 DEBUG Scanner max available memory: 3 GB
14:00:59.628 DEBUG uname -m returned 'x86_64'
14:00:59.629 WARN  Both 'sonar.login' and 'sonar.token' (or the 'SONAR_TOKEN' env variable) are set, but only the latter will be used.
14:00:59.630 DEBUG Using scanner truststore: /home/runner/.sonar/ssl/truststore.p12
14:00:59.631 DEBUG Create: /home/runner/.sonar/cache
14:00:59.631 INFO  User cache: /home/runner/.sonar/cache
14:00:59.631 DEBUG Create: /home/runner/.sonar/cache/_tmp
14:00:59.715 DEBUG Loading OS trusted SSL certificates...
14:00:59.715 DEBUG This operation might be slow or even get stuck. You can skip it by passing the scanner property 'sonar.scanner.skipSystemTruststore=true'
14:00:59.939 DEBUG Loaded [440] system trusted certificates
14:01:00.217 DEBUG Loaded truststore from '/home/runner/.sonar/ssl/truststore.p12' containing 1 certificates
14:01:00.345 DEBUG --> GET <HOST_URL>/api/v2/analysis/version
14:01:05.495 DEBUG <-- HTTP FAILED: java.net.SocketTimeoutException: Connect timed out
14:01:05.495 ERROR Failed to query server version: Call to URL [<HOST_URL>/api/v2/analysis/version] failed: Connect timed out
org.sonarsource.scanner.lib.internal.MessageException: Failed to query server version: Call to URL [<HOST_URL>/api/v2/analysis/version] failed: Connect timed out

NOTE: I replaced the host URL with <HOST_URL> for privacy.

I was able to navigate the URL with the browser and it returns the version as expected.
I configured the SONAR_ROOT_CERT by following the official documentation.

I’m looking forward to resolve this issue at the earliest. Please let me know if any more details required.

Hey @banezaluhol0t2,

Looks like your GitHub Actions runner can’t connect to your private SonarQube server—the error Connect timed out almost always means a networking issue. The most common cause: your SonarQube server is only reachable from your local/internal network, while GitHub-hosted runners are out in the cloud.

If your SonarQube server is hosted on an isolated (air-gapped) network with no external connections allowed, then unfortunately, you’re out of luck using GitHub’s hosted runners—they simply can’t get in. In that case, your only real option is to set up a self-hosted GitHub Actions runner on a machine with access to your SonarQube network. This way, the runner can “see” SonarQube and your jobs will work.

Hope this clears things up!

1 Like

Thanks for your quick response @Colin.
I’ll try out given steps and come back if I’m still facing errors.

@Colin I confirmed with my operation team folks that the GitHub runners are in public network while SonarQube accessible only within our private network is the reason for this issue.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.