SonarSource/sonarqube · error · NotFoundException

GitHub configuration with id

Error message

GitHub configuration with id %s not found

What it means

GithubConfigurationService, like its GitLab and email counterparts, supports exactly one GitHub configuration identified by UNIQUE_GITHUB_CONFIGURATION_ID. throwIfNotUniqueConfigurationId throws NotFoundException for any other id passed to getConfiguration or deleteConfiguration. The id is reserved, so a mismatched id simply cannot resolve to a configuration.

Solutions

  1. Fetch the existing configuration to read its actual id, then use that id for updates/deletes
  2. Use the documented reserved id for the singleton GitHub configuration
  3. Handle 404 (NotFoundException) as 'no such configuration id' in client code and list configs to recover

Example fix

// before
deleteConfiguration("github-prod")
// after
var cfg = getConfiguration(UNIQUE_GITHUB_CONFIGURATION_ID); // or read from GET endpoint
deleteConfiguration(cfg.getId());
Defensive patterns

Strategy: validation

Validate before calling

var existing = client.getGithubConfiguration(); // discover the real id
if (existing.isEmpty()) throw new IllegalStateException("GitHub configuration not yet created");
String id = existing.get().getId();

Type guard

boolean isKnownGithubConfigId(String id, Set<String> knownIds) {
  return id != null && knownIds.contains(id);
}

Try / catch

try {
  service.deleteConfiguration(id);
} catch (NotFoundException e) {
  log.warn("id '{}' is not the supported GitHub configuration id", id);
}

Prevention

When it happens

Trigger: GET/DELETE api/github/configuration (or service methods) with an arbitrary id string instead of the platform's fixed configuration id; clients reusing ids from a multi-config era or other products.

Common situations: Terraform/API scripts templating ids like 'github-prod'; integration tests hard-coding ids; copying request payloads between GitHub and GitLab configuration endpoints.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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

Appendix: source

Thrown at server/sonar-webserver-common/src/main/java/org/sonar/server/common/github/config/GithubConfigurationService.java:231

  private Boolean getBooleanOrFalseFromEmptyProperty(DbSession dbSession, String property) {
    return Optional.ofNullable(dbClient.propertiesDao().selectGlobalProperty(dbSession, property))
      .isPresent();
  }

  private Boolean getInternalBooleanOrFalse(DbSession dbSession, String property) {
    return dbClient.internalPropertiesDao().selectByKey(dbSession, property)
      .map(Boolean::valueOf)
      .orElse(false);
  }

  private String getStringPropertyOrEmpty(DbSession dbSession, String property) {
    return Optional.ofNullable(dbClient.propertiesDao().selectGlobalProperty(dbSession, property))
      .map(PropertyDto::getValue).orElse("");
  }

  private static void throwIfNotUniqueConfigurationId(String id) {
    if (!UNIQUE_GITHUB_CONFIGURATION_ID.equals(id)) {
      throw new NotFoundException(format("GitHub configuration with id %s not found", id));
    }
  }

  public void deleteConfiguration(String id) {
    throwIfNotUniqueConfigurationId(id);
    try (DbSession dbSession = dbClient.openSession(false)) {
      throwIfConfigurationDoesntExist(dbSession);
      GITHUB_CONFIGURATION_PROPERTIES.forEach(property -> dbClient.propertiesDao().deleteGlobalProperty(property, dbSession));
      dbClient.internalPropertiesDao().delete(dbSession, GITHUB_PROVISIONING);
      dbClient.externalGroupDao().deleteByExternalIdentityProvider(dbSession, GitHubIdentityProvider.KEY);
      dbSession.commit();
    }
  }

  private void throwIfConfigurationDoesntExist(DbSession dbSession) {
    checkFound(dbClient.propertiesDao().selectGlobalProperty(dbSession, GITHUB_ENABLED), "GitHub configuration doesn't exist.");
  }

View on GitHub (pinned to 184c821202)