Could not validate GitLab url. Got an unexpected answer

Hello everyone!
I’m Roberta and I’m new to the community!
I’m a DevOps engineer and thank you in advance for the help you will give me!
Today I tried to create the SonarQube - GitLab integration but to no avail.

Here’s some information about the environment I’m working on.

SonarQube GitLab
Community Edition v10.5.1 Community Edition v16.11.0
self-hosted self-hosted
Docker Docker

I created an account on GitLab that I’m going to use for SonarQube and I followed the guide shown here.

After all i received the error:

Could not validate GitLab url. Got an unexpected answer.

My Server Web logs contains the following:

2024.05.03 15:17:51 DEBUG web[][o.s.a.c.g.GitlabApplicationClient] get projects : []
2024.05.03 15:17:51 INFO  web[][o.s.a.c.g.GitlabApplicationClient] Gitlab API call to [] failed with error message : [Unexpected response code for CONNECT: 500] Unexpected response code for CONNECT: 500
	at okhttp3.internal.connection.RealConnection.createTunnel(RealConnection.kt:483)
	at okhttp3.internal.connection.RealConnection.connectTunnel(RealConnection.kt:262)
	at okhttp3.internal.connection.RealConnection.connect(RealConnection.kt:201)
	at okhttp3.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.kt:226)
	at okhttp3.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.kt:106)
	at okhttp3.internal.connection.ExchangeFinder.find(ExchangeFinder.kt:74)
	at okhttp3.internal.connection.RealCall.initExchange$okhttp(RealCall.kt:255)
	at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:32)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
	at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:95)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
	at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:83)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
	at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:76)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
	at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201)
	at okhttp3.internal.connection.RealCall.execute(RealCall.kt:154)
	at org.sonar.alm.client.gitlab.GitlabApplicationClient.checkProjectAccess(
	at org.sonar.alm.client.gitlab.GitlabApplicationClient.checkUrl(
	at org.sonar.alm.client.gitlab.GitlabGlobalSettingsValidator.validate(
	at org.sonar.alm.client.gitlab.GitlabGlobalSettingsValidator.validate(
	at org.sonar.server.monitoring.devops.GitlabMetricsTask.validateGitlab(
	at java.base/java.util.concurrent.Executors$ Source)
	at java.base/java.util.concurrent.FutureTask.runAndReset(Unknown Source)
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$ Source)
	at java.base/ Source)

Finally, from inside my sonarqube container I executed

curl --header "PRIVATE-TOKEN: $mytoken" ""

and I received the correct JSON.

The only thing that came to mind is that the format of my GitLab’s URL could be a problem, because by trying with

    I don’t get the previous error, but:

Request was redirected, please provide the correct URL

    I don’t get the previous error, but:

Invalid personal access token

Can you help me, please?

Hi Roberta,

Welcome to the community!

This looks like a problem on the GitLab side. Did you check the logs over there?


Hi @ganncamp and thanks for your reply.

I investigated all logs of my GitLab instance but I don’t find anything.

I really don’t know what to do :frowning_face:

The last information I can give you is that my GitLab url point to a Kong gateway that forward request to GitLab, but I checked and no trace of errors even on Kong!


Is it possible to bypass the stuff in the middle and connect directly from SonarQube to GitLab?

Do you have network folks who could help you on this?


Unfortunately it is not possible to bypass Kong.

As mentioned in my first post, from inside my SonarQube container I am able to call, so I suppose there is no network problems…



I’m sorry. I don’t know where else to tell you to look. SonarQube makes the call and receives an error. It’s not SonarQube making the error.



thank you so much @ganncamp for your help! I will investigate on GitLab side and if I find a solution I’ll post it, maybe it will be useful to others.

Thank you!


1 Like