{"record":{"id":"69f1f7722aba9adb","repo":"SonarSource/sonarqube","slug":"s-contains-the-invalid-character-s-azure-de","errorCode":null,"errorMessage":"'%s' contains the invalid character '%s'. Azure DevOps names must not contain any of: \\ / : < > | ? *","messagePattern":"'(.+?)' contains the invalid character '(.+?)'\\. Azure DevOps names must not contain any of: \\\\ / : < > \\| \\? \\*","errorType":"validation","errorClass":"BadRequestException","httpStatus":400,"severity":"error","filePath":"server/sonar-webserver-webapi/src/main/java/org/sonar/server/almsettings/ws/AlmSettingsSupport.java","lineNumber":145,"sourceCode":"    }\n  }\n\n  public void validateUrl(@Nullable String url) {\n    if (url == null || HttpUrl.parse(url) == null) {\n      LOG.warn(\"Rejected an invalid DevOps Platform URL\");\n      throw BadRequestException.create(format(\"Invalid URL: '%s'.\", url));\n    }\n  }\n\n  public void validateAzureName(String fieldName, String value) {\n    Matcher matcher = AZURE_NAME_INVALID_CHARS.matcher(value);\n    if (matcher.find()) {\n      String invalidChar = matcher.group();\n      if (LOG.isWarnEnabled()) {\n        LOG.warn(\"Rejected Azure DevOps name for field '{}': contains invalid character '{}'\", fieldName, invalidChar);\n      }\n      throw BadRequestException.create(format(\n        \"'%s' contains the invalid character '%s'. Azure DevOps names must not contain any of: \\\\ / : < > | ? *\",\n        fieldName, invalidChar));\n    }\n  }\n\n  public ProjectDto getProjectAsAdmin(DbSession dbSession, String projectKey) {\n    return getProject(dbSession, projectKey, ADMIN);\n  }\n\n  public ProjectDto getProject(DbSession dbSession, String projectKey, ProjectPermission projectPermission) {\n    ProjectDto project = componentFinder.getProjectByKey(dbSession, projectKey);\n    userSession.checkEntityPermission(projectPermission, project);\n    return project;\n  }\n\n  public record NewAzureSetting(String key, String url, String personalAccessToken) {\n  }\n\n  public record NewGitlabSetting(String key, String url, String personalAccessToken) {","sourceCodeStart":127,"sourceCodeEnd":163,"githubUrl":"https://github.com/SonarSource/sonarqube/blob/184c821202192afc1c599fc912d0889b69fffa53/server/sonar-webserver-webapi/src/main/java/org/sonar/server/almsettings/ws/AlmSettingsSupport.java#L127-L163","documentation":"AlmSettingsSupport.validateAzureName checks that Azure DevOps name fields (project, repository, etc.) contain none of the characters \\ / : < > | ? *, which Azure DevOps forbids. On violation it logs a warning and throws BadRequestException naming the field and the offending character.","triggerScenarios":"Creating/updating an Azure DevOps ALM setting where the field value passed to validateAzureName contains a forbidden character; the matcher finds the first invalid char and it is embedded in the 400 message.","commonSituations":"Azure project names containing slashes or spaces-separated paths; automation copying full repo paths ('repo/subdir') into the repository field; names with special characters from templating systems.","solutions":["Remove the reported invalid character from the field value named in the message","Use the Azure DevOps project/repository display name, not a path with slashes","Sanitize user-supplied names in automation before calling the API","Rename the project/repo in Azure DevOps if its actual name contains forbidden characters"],"exampleFix":"// before\nalmSettings.updateAzure(\"ado\", \"TeamProject/SubProject\");\n// after\nalmSettings.updateAzure(\"ado\", \"TeamProject SubProject\");","handlingStrategy":"validation","validationCode":"private static final Pattern INVALID = Pattern.compile(\"[\\\\\\\\/:<>|?*]\");\nvoid assertValidAzureName(String v) { Matcher m = INVALID.matcher(v); if (m.find()) throw new IllegalArgumentException(\"contains invalid character \" + m.group()); }","typeGuard":"boolean isValidAzureName(String v) { return v != null && !Pattern.compile(\"[\\\\\\\\/:<>|?*]\").matcher(v).find(); }","tryCatchPattern":"try { support.validateAzureName(\"project\", name); } catch (BadRequestException e) { sanitizeNameAndRetry(); }","preventionTips":["Sanitize Azure names against \\\\ / : < > | ? * before API calls","Use display names, never slash-separated paths","Document the character restriction wherever Azure settings are collected"],"tags":["bad-request","azure-devops","validation"],"backgroundTag":"invalid-argument-value","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"}