{"record":{"id":"f4c3a5b64c78d7e4","repo":"SonarSource/sonarqube","slug":"github-configuration-with-id-s-not-found","errorCode":null,"errorMessage":"GitHub configuration with id %s not found","messagePattern":"GitHub configuration with id (.+?) not found","errorType":"exception","errorClass":"NotFoundException","httpStatus":404,"severity":"error","filePath":"server/sonar-webserver-common/src/main/java/org/sonar/server/common/github/config/GithubConfigurationService.java","lineNumber":231,"sourceCode":"  private Boolean getBooleanOrFalseFromEmptyProperty(DbSession dbSession, String property) {\n    return Optional.ofNullable(dbClient.propertiesDao().selectGlobalProperty(dbSession, property))\n      .isPresent();\n  }\n\n  private Boolean getInternalBooleanOrFalse(DbSession dbSession, String property) {\n    return dbClient.internalPropertiesDao().selectByKey(dbSession, property)\n      .map(Boolean::valueOf)\n      .orElse(false);\n  }\n\n  private String getStringPropertyOrEmpty(DbSession dbSession, String property) {\n    return Optional.ofNullable(dbClient.propertiesDao().selectGlobalProperty(dbSession, property))\n      .map(PropertyDto::getValue).orElse(\"\");\n  }\n\n  private static void throwIfNotUniqueConfigurationId(String id) {\n    if (!UNIQUE_GITHUB_CONFIGURATION_ID.equals(id)) {\n      throw new NotFoundException(format(\"GitHub configuration with id %s not found\", id));\n    }\n  }\n\n  public void deleteConfiguration(String id) {\n    throwIfNotUniqueConfigurationId(id);\n    try (DbSession dbSession = dbClient.openSession(false)) {\n      throwIfConfigurationDoesntExist(dbSession);\n      GITHUB_CONFIGURATION_PROPERTIES.forEach(property -> dbClient.propertiesDao().deleteGlobalProperty(property, dbSession));\n      dbClient.internalPropertiesDao().delete(dbSession, GITHUB_PROVISIONING);\n      dbClient.externalGroupDao().deleteByExternalIdentityProvider(dbSession, GitHubIdentityProvider.KEY);\n      dbSession.commit();\n    }\n  }\n\n  private void throwIfConfigurationDoesntExist(DbSession dbSession) {\n    checkFound(dbClient.propertiesDao().selectGlobalProperty(dbSession, GITHUB_ENABLED), \"GitHub configuration doesn't exist.\");\n  }\n","sourceCodeStart":213,"sourceCodeEnd":249,"githubUrl":"https://github.com/SonarSource/sonarqube/blob/184c821202192afc1c599fc912d0889b69fffa53/server/sonar-webserver-common/src/main/java/org/sonar/server/common/github/config/GithubConfigurationService.java#L213-L249","documentation":"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.","triggerScenarios":"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.","commonSituations":"Terraform/API scripts templating ids like 'github-prod'; integration tests hard-coding ids; copying request payloads between GitHub and GitLab configuration endpoints.","solutions":["Fetch the existing configuration to read its actual id, then use that id for updates/deletes","Use the documented reserved id for the singleton GitHub configuration","Handle 404 (NotFoundException) as 'no such configuration id' in client code and list configs to recover"],"exampleFix":"// before\ndeleteConfiguration(\"github-prod\")\n// after\nvar cfg = getConfiguration(UNIQUE_GITHUB_CONFIGURATION_ID); // or read from GET endpoint\ndeleteConfiguration(cfg.getId());","handlingStrategy":"validation","validationCode":"var existing = client.getGithubConfiguration(); // discover the real id\nif (existing.isEmpty()) throw new IllegalStateException(\"GitHub configuration not yet created\");\nString id = existing.get().getId();","typeGuard":"boolean isKnownGithubConfigId(String id, Set<String> knownIds) {\n  return id != null && knownIds.contains(id);\n}","tryCatchPattern":"try {\n  service.deleteConfiguration(id);\n} catch (NotFoundException e) {\n  log.warn(\"id '{}' is not the supported GitHub configuration id\", id);\n}","preventionTips":["Fetch the id from the GET endpoint instead of hard-coding custom ids","Handle 404 on singleton config APIs as 'wrong id' and re-list","Keep API payloads uniform across integrations to avoid id cross-contamination"],"tags":["github","configuration","not-found"],"backgroundTag":"resource-not-found","analyzedSha":"184c821202192afc1c599fc912d0889b69fffa53","analyzedAt":"2026-09-09T12:23:51.573Z","contentChangedAt":"2026-09-09T12:23:51.573Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}