{"record":{"id":"0655493f53a5a6bf","repo":"SonarSource/sonarqube","slug":"gitlab-configuration-with-id-s-not-found","errorCode":null,"errorMessage":"Gitlab configuration with id %s not found","messagePattern":"Gitlab 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/gitlab/config/GitlabConfigurationService.java","lineNumber":190,"sourceCode":"\n  private Boolean getBooleanOrFalse(DbSession dbSession, String property) {\n    return Optional.ofNullable(dbClient.propertiesDao().selectGlobalProperty(dbSession, property))\n      .map(dto -> Boolean.valueOf(dto.getValue())).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 String getStringPropertyOrNull(DbSession dbSession, String property) {\n    return Optional.ofNullable(dbClient.propertiesDao().selectGlobalProperty(dbSession, property))\n      .map(dto -> Strings.emptyToNull(dto.getValue())).orElse(null);\n  }\n\n  private static void throwIfNotUniqueConfigurationId(String id) {\n    if (!UNIQUE_GITLAB_CONFIGURATION_ID.equals(id)) {\n      throw new NotFoundException(format(\"Gitlab 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      GITLAB_CONFIGURATION_PROPERTIES.forEach(property -> dbClient.propertiesDao().deleteGlobalProperty(property, dbSession));\n      dbClient.externalGroupDao().deleteByExternalIdentityProvider(dbSession, GitLabIdentityProvider.KEY);\n      dbSession.commit();\n    }\n  }\n\n  private void throwIfConfigurationDoesntExist(DbSession dbSession) {\n    checkFound(dbClient.propertiesDao().selectGlobalProperty(dbSession, GITLAB_AUTH_ENABLED), \"GitLab configuration doesn't exist.\");\n  }\n\n  private static ProvisioningType toProvisioningType(boolean provisioningEnabled) {","sourceCodeStart":172,"sourceCodeEnd":208,"githubUrl":"https://github.com/SonarSource/sonarqube/blob/184c821202192afc1c599fc912d0889b69fffa53/server/sonar-webserver-common/src/main/java/org/sonar/server/common/gitlab/config/GitlabConfigurationService.java#L172-L208","documentation":"GitlabConfigurationService supports a single GitLab configuration keyed by UNIQUE_GITLAB_CONFIGURATION_ID. throwIfNotUniqueConfigurationId throws NotFoundException for any other id passed to getConfiguration or deleteConfiguration. Any caller-provided id other than the reserved one cannot match, hence 'not found'.","triggerScenarios":"GET/DELETE GitLab configuration endpoints with arbitrary ids (e.g. 'gitlab-prod', a UUID) instead of the fixed supported id; stale clients or payloads reused from other integrations.","commonSituations":"Automation templating configuration ids; docs/tutorials referencing multi-config products; typos or case differences in the reserved id.","solutions":["List/read the existing GitLab configuration to obtain its real id and use exactly that","Use the documented singleton configuration id for reads and deletes","Treat NotFoundException as 'wrong id' and fall back to listing configs rather than retrying the same id"],"exampleFix":"// before\ndeleteConfiguration(\"gitlab-prod\")\n// after\nvar cfg = getConfiguration(UNIQUE_GITLAB_CONFIGURATION_ID);\ndeleteConfiguration(cfg.getId());","handlingStrategy":"validation","validationCode":"var existing = client.getGitlabConfiguration();\nif (existing.isEmpty()) throw new IllegalStateException(\"GitLab configuration not yet created\");\nString id = existing.get().getId(); // the only valid id","typeGuard":"boolean isKnownGitlabConfigId(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(\"'{}' is not the singleton GitLab configuration id\", id);\n}","preventionTips":["Use the id returned by the GET endpoint; never template custom ids","Treat 404 on these singleton config APIs as 'wrong id', not transient","Share a generic singleton-config client across email/github/gitlab endpoints"],"tags":["gitlab","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"}