SonarSource/sonarqube · error · IllegalStateException
SonarQube was not able to retrieve resources from external s
Error message
SonarQube was not able to retrieve resources from external system. Error while executing a paginated call to %s, endpoint:%s.
What it means
This is the wrapper thrown by executeCall's catch(Exception) block: any failure while executing a paginated call (non-2xx response, network error, invalid URL) is logged with full detail and rethrown as an IllegalStateException prefixed with 'SonarQube was not able to retrieve resources from external system'. The original cause message is appended.
Source
Thrown at server/sonar-alm-client/src/main/java/org/sonar/alm/client/GenericPaginatedHttpClient.java:89
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
LOG.warn(format("Thread interrupted: %s", e.getMessage()), e);
}
}
private GetResponse executeCall(String appUrl, AccessToken token, String endpoint) {
try {
GetResponse response = appHttpClient.get(appUrl, token, endpoint);
if (response.getCode() < 200 || response.getCode() >= 300) {
throw new IllegalStateException(
format("Error while executing a call to %s. Return code %s. Error message: %s.", appUrl, response.getCode(), response.getContent().orElse("")));
}
return response;
} catch (Exception e) {
String errorMessage = format("SonarQube was not able to retrieve resources from external system. Error while executing a paginated call to %s, endpoint:%s.",
appUrl, endpoint);
logException(errorMessage, e);
throw new IllegalStateException(errorMessage + " " + e.getMessage());
}
}
private static void logException(String message, Exception e) {
if (LOG.isDebugEnabled()) {
LOG.warn(message, e);
} else {
LOG.warn(message, e.getMessage());
}
}
}
View on GitHub (pinned to 184c821202)
Solutions
- Read the appended cause and the WARN log line (logException) to find the root error, then fix it specifically.
- Test connectivity from the SonarQube host: curl the configured appUrl endpoint.
- If TLS-related, import the ALM server certificate into the JVM truststore.
- Re-check the DevOps platform integration settings (URL, token) and retry the import.
Example fix
// before URL=http://internal-azure (unreachable from SonarQube host) // after URL=https://devops.internal.example.com (resolvable and reachable)
Defensive patterns
Strategy: try-catch
Validate before calling
static boolean canReach(String appUrl) {
try {
HttpURLConnection c = (HttpURLConnection) new java.net.URI(appUrl).toURL().openConnection();
c.setConnectTimeout(5000);
return c.getResponseCode() > 0;
} catch (Exception e) { return false; }
} Try / catch
try {
items = paginatedClient.listAll(appUrl, token, endpoint);
} catch (IllegalStateException e) {
// message is "SonarQube was not able to retrieve resources ..." + cause
LOG.warn("Devops import failed: {}", e.getMessage());
// fall back to last synced data
items = lastKnownSnapshot();
} Prevention
- Check network reachability (DNS, firewall, TLS trust) from the SonarQube host to the ALM server before configuring.
- Always read the WARN log line produced by logException for the root cause.
- Use fully qualified https URLs in integration settings.
- Keep cause messages intact when wrapping so users see the underlying error.
When it happens
Trigger: Any exception inside the paginated GET: IllegalStateException from a non-2xx code (see executeCall), IOException/connection failure to the ALM host, IllegalArgumentException from an invalid URL, or response-body reading failure.
Common situations: ALM server unreachable (DNS/firewall), TLS certificate not trusted by SonarQube's JVM, expired PAT causing 401, misconfigured URL after migrating the ALM server.
Understand the failure class
Background: "API request failed": what wrapped HTTP errors from external APIs mean and how to find the real cause — this error's family across 29 libraries.
Related errors
- Error while executing a call to %s. Return code %s. Error me
- generateErrorMessage(body)
- %s for request [%s]: [%s]
- Invalid Azure URL
- Unable to contact Bitbucket server
AI-assisted analysis of SonarSource/sonarqube@184c821202 (2026-09-09).
Data as JSON: /api/errors/d1bf480b265d60ab.
Report an issue: GitHub.