SonarSource/sonarqube · error · IllegalArgumentException
Missing Client Id
Error message
Missing Client Id
What it means
buildConfiguration requires a non-blank OAuth Client Id when validating GitHub global settings. If the clientId setting is null or blank, this IllegalArgumentException is thrown. GitHub bindings need the Client Id to support user-access-token based features.
Source
Thrown at server/sonar-alm-client/src/main/java/org/sonar/alm/client/github/GithubGlobalSettingsValidator.java:99
*/
public List<String> findMissingPermissions(AlmSettingDto almSettingDto, Map<String, String> requiredPermissions) {
GithubAppConfiguration configuration = buildConfiguration(almSettingDto.getAppId(), almSettingDto.getClientId(),
almSettingDto.getClientSecret(), almSettingDto.getPrivateKey(), almSettingDto.getUrl());
githubApplicationClient.checkApiEndpoint(configuration);
return githubApplicationClient.findMissingAppPermissions(configuration, requiredPermissions);
}
private GithubAppConfiguration buildConfiguration(@Nullable String applicationId, @Nullable String clientId, String clientSecret, String privateKey,
@Nullable String url) {
long appId;
try {
appId = Long.parseLong(Optional.ofNullable(applicationId).orElseThrow(() -> new IllegalArgumentException("Missing appId")));
} catch (NumberFormatException e) {
throw new IllegalArgumentException("Invalid appId; " + e.getMessage());
}
if (isBlank(clientId)) {
throw new IllegalArgumentException("Missing Client Id");
}
if (isBlank(getDecryptedSettingValue(clientSecret))) {
throw new IllegalArgumentException("Missing Client Secret");
}
return new GithubAppConfiguration(appId, getDecryptedSettingValue(privateKey), url);
}
private String getDecryptedSettingValue(String setting) {
if (StringUtils.isNotEmpty(setting) && encryption.isEncrypted(setting)) {
return encryption.decrypt(setting);
}
return setting;
}
}
View on GitHub (pinned to 184c821202)
Solutions
- Enter the Client Id from GitHub App settings (About section) in the SonarQube GitHub configuration and save.
- If using configuration-as-code, add the clientId property to the provisioning definition.
- Verify the saved settings with GET api/settings/values?keys=sonar.auth.github.clientId.secured,sonar.auth.github.clientId.
- Distinguish Client Id (string like Iv1.x) from the numeric App ID; each field needs its own value.
Example fix
// before (settings map)
{ "sonar.auth.github.appId": "123456", "sonar.auth.github.clientSecret.secured": "***" } // clientId missing
// after
{ "sonar.auth.github.appId": "123456", "sonar.auth.github.clientId": "Iv1.8f2a9c1b", "sonar.auth.github.clientSecret.secured": "***" } Defensive patterns
Strategy: validation
Validate before calling
// check required settings before invoking the validator
if (clientId == null || clientId.isBlank()) throw new IllegalArgumentException("sonar.auth.github.clientId must be set");
if (clientSecret == null || clientSecret.isBlank()) throw new IllegalArgumentException("sonar.auth.github.clientSecret.secured must be set"); Type guard
function hasClientId(config) { return typeof config.clientId === 'string' && config.clientId.trim().length > 0; } Try / catch
try { validator.configuration(appId, clientId, secret, key, url); } catch (IllegalArgumentException e) { if ("Missing Client Id".equals(e.getMessage())) { markSettingRequired("sonar.auth.github.clientId"); } throw e; } Prevention
- Include clientId in configuration-as-code exports/imports
- Validate all required GitHub settings in one pre-save pass
- Do not clear non-secret settings when rotating secrets
- Differentiate App ID (numeric) and Client Id (Iv1.x) fields in the UI
When it happens
Trigger: Calling configuration(...) with a null/empty/whitespace clientId while other fields are set — e.g. the setting was never saved or was cleared during an upgrade/import.
Common situations: Partial configuration where only appId and private key were entered; configuration-as-code export missing the clientId; secret management clearing non-secret settings; user confusion between App ID and Client Id fields.
Understand the failure class
Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.
Related errors
- Invalid appId;
- Missing URL
- Invalid URL, %s
- Failed to check permissions with Github, check the configura
- Failed to list all organizations accessible by user access t
AI-assisted analysis of SonarSource/sonarqube@184c821202 (2026-09-09).
Data as JSON: /api/errors/8cf6a1041e13a3e1.
Report an issue: GitHub.