SonarSource/sonarqube · error · NotFoundException

No client ID for setting with key

Error message

No client ID for setting with key '%s'

What it means

NotFoundException from GetGithubClientIdAction.doHandle when the referenced GitHub DevOps Platform setting exists but has no client ID stored (null). The client ID is only populated for GitHub App (manifest-based) configurations, so plain GitHub PAT settings will hit this.

Solutions

  1. Complete the GitHub App creation via the manifest flow so the client ID gets stored
  2. Create a new GitHub App and record its client ID in the setting
  3. Use a setting key that actually corresponds to a GitHub App configuration

Example fix

// before
almSetting = almSettings.selectByKey('github-pat-setting') // has no clientId
// after
almSetting = almSettings.selectByKey('github-app-setting') // created via manifest, clientId set
Defensive patterns

Strategy: try-catch

Validate before calling

const settings = await ws.get('api/alm_settings/list');
const s = settings.almSettings.find(x => x.key === key);
if (!s || !s.clientId) throw new Error(`Setting '${key}' has no GitHub App client ID; complete the manifest flow`);

Type guard

const hasClientId = (s) => typeof s?.clientId === 'string' && s.clientId.length > 0;

Try / catch

try {
  return await ws.get('api/alm_integrations/github/client_id', {almSetting: key});
} catch (e) {
  if (e.status === 404 && /No client ID/.test(e.message)) {
    return null; // fall back to manual GitHub App setup
  }
  throw e;
}

Prevention

When it happens

Trigger: GET api/alm_integrations/github/client_id?almSetting=<key> where the setting was created manually (no clientId column value) instead of via the GitHub App manifest flow.

Common situations: Admin configured GitHub with a PAT/app URL manually and a frontend page then asks for the client id for the OAuth redirect; pointing the call at the wrong setting key.

Related errors


AI-assisted analysis of SonarSource/sonarqube@184c821202 (2026-09-09). Data as JSON: /api/errors/8d489aa9c6e5469c. Report an issue: GitHub.

Appendix: source

Thrown at server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/github/GetGithubClientIdAction.java:78

      .setDescription("DevOps Platform setting key");
  }

  @Override
  public void handle(Request request, Response response) {
    AlmIntegrations.GithubClientIdWsResponse getResponse = doHandle(request);
    writeProtobuf(getResponse, request, response);
  }

  private AlmIntegrations.GithubClientIdWsResponse doHandle(Request request) {
    try (DbSession dbSession = dbClient.openSession(false)) {
      userSession.checkLoggedIn().checkPermission(PROVISION_PROJECTS);

      String almSettingKey = request.mandatoryParam(PARAM_ALM_SETTING);
      AlmSettingDto almSetting = dbClient.almSettingDao().selectByKey(dbSession, almSettingKey)
        .orElseThrow(() -> new NotFoundException(String.format("Github Setting '%s' not found", almSettingKey)));

      if (almSetting.getClientId() == null) {
        throw new NotFoundException(String.format("No client ID for setting with key '%s'", almSettingKey));
      }
      return AlmIntegrations.GithubClientIdWsResponse.newBuilder()
        .setClientId(almSetting.getClientId())
        .build();
    }
  }
}

View on GitHub (pinned to 184c821202)