Cannot add SonarQube server connection - Error while querying SonarCloud organizations

  • Operating system: Windows 10
  • SonarLint plugin version: 4.14.0 (Latest)
  • Programming language you’re coding in: Python
  • Is connected mode used: N/A (Trying to connect but fails with error in topic header)
    • Connected to SonarCloud or SonarQube (and which version): 10.1.0.73491

I get the following error when trying to connect to add SonarQube Server Connection.

[Debug - 16:50:04.814] Load user organizations...
[Debug - 16:50:05.400] GET 401 https://sonarcloud.io/api/organizations/search.protobuf?member=true&ps=500&p=1 | response time=585ms
[Error - 16:50:05.400] Error while querying SonarCloud organizations
[Error - 16:50:05.400] java.lang.IllegalStateException: Not authorized. Please check server credentials.
	at org.sonarsource.sonarlint.core.serverapi.ServerApiHelper.handleError(ServerApiHelper.java:141)
	at org.sonarsource.sonarlint.core.serverapi.ServerApiHelper.processPage(ServerApiHelper.java:206)
	at org.sonarsource.sonarlint.core.serverapi.ServerApiHelper.lambda$getPaginated$2(ServerApiHelper.java:195)
	at org.sonarsource.sonarlint.core.serverapi.ServerApiHelper.lambda$consumeTimed$4(ServerApiHelper.java:255)
	at org.sonarsource.sonarlint.core.serverapi.ServerApiHelper.processTimed(ServerApiHelper.java:244)
	at org.sonarsource.sonarlint.core.serverapi.ServerApiHelper.consumeTimed(ServerApiHelper.java:254)
	at org.sonarsource.sonarlint.core.serverapi.ServerApiHelper.getPaginated(ServerApiHelper.java:193)
	at org.sonarsource.sonarlint.core.serverapi.organization.OrganizationApi.getPaginatedOrganizations(OrganizationApi.java:56)
	at org.sonarsource.sonarlint.core.serverapi.organization.OrganizationApi.fetchUserOrganizations(OrganizationApi.java:50)
	at org.sonarsource.sonarlint.core.serverapi.organization.OrganizationApi.listUserOrganizations(OrganizationApi.java:38)
	at org.sonarsource.sonarlint.core.OrganizationsCache.lambda$getTextSearchIndex$3(OrganizationsCache.java:78)
	at com.google.common.cache.LocalCache$LocalManualCache$1.load(LocalCache.java:4925)
	at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3571)
	at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2313)
	at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2190)
	at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2080)
	at com.google.common.cache.LocalCache.get(LocalCache.java:4012)
	at com.google.common.cache.LocalCache$LocalManualCache.get(LocalCache.java:4920)
	at org.sonarsource.sonarlint.core.OrganizationsCache.getTextSearchIndex(OrganizationsCache.java:73)
	at org.sonarsource.sonarlint.core.OrganizationsCache.listUserOrganizations(OrganizationsCache.java:101)
	at org.sonarsource.sonarlint.core.rpc.impl.ConnectionRpcServiceDelegate.lambda$listUserOrganizations$5(ConnectionRpcServiceDelegate.java:83)
	at org.sonarsource.sonarlint.core.rpc.impl.AbstractRpcServiceDelegate.lambda$requestAsync$0(AbstractRpcServiceDelegate.java:67)
	at org.sonarsource.sonarlint.core.rpc.impl.AbstractRpcServiceDelegate.computeWithLogger(AbstractRpcServiceDelegate.java:135)
	at org.sonarsource.sonarlint.core.rpc.impl.AbstractRpcServiceDelegate.lambda$requestAsync$1(AbstractRpcServiceDelegate.java:65)
	at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:690)
	at java.base/java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:526)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1575)

I just realized while I am having the same problem in the 4.13.2 version, I can still go ahead and save the connection. But in 4.14.0, it does not let me save the connection.

Hi there @ppanchal-mobiz, welcome to Sonar Community! :wave: :sonar:

Thanks a lot for reporting this behaviour. I was able to reproduce the error in the logs, and created this ticket to fix it. Normally, it is just a noisy (buggy) log that should not affect connection creation to SonarQube Server.

Would you be able to share the full logs with us? Please note that in order to connect to SonarQube Server, you need to generate a User Token, as per our docs.

All the best,
Sophio

Hello again,

In fact, (thanks to you :bowing_woman:) we found an actual regression that prevents connection creation with SonarQube Server versions higher than 10.0 and lower than 10.4 :scream:. We apologise for the inconvenience and will get this fixed ASAP.

In the meantime, you can revert back to 4.13.2.

All the best,
Sophio

Thank you for your prompt reply, happy to provide any further information if needed. Will wait for the fix until I update the extension again.

So either reverting back to 4.13.2 or updating the server to above 10.4 will work, right?

Hello,

I see you have pushed the changes in 4.14.1 and can confirm it is working fine. I can create the connection now.

Thank you for the quick action.

Awesome! :star_struck:

Indeed, the fix was part of 4.14.1. I still encourage you to update your SonarQube Server version in the near future, as 10.1 is no longer an active version.

All the best,
Sophio

That is perfect. We will update the server version soon. Thank you for your support.

1 Like

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