{"record":{"id":"56801485bf6b4516","repo":"SonarSource/sonarqube","slug":"invalid-appid","errorCode":null,"errorMessage":"Invalid appId; ","messagePattern":"Invalid appId; ","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"server/sonar-alm-client/src/main/java/org/sonar/alm/client/github/GithubGlobalSettingsValidator.java","lineNumber":96,"sourceCode":"   * (empty when all {@code requiredPermissions} are granted) instead of throwing when some are missing — for callers\n   * that need the structured result (SONAR-31626). Still throws {@link IllegalArgumentException} on invalid\n   * configuration, authentication or connectivity failures.\n   */\n  public List<String> findMissingPermissions(AlmSettingDto almSettingDto, Map<String, String> requiredPermissions) {\n    GithubAppConfiguration configuration = buildConfiguration(almSettingDto.getAppId(), almSettingDto.getClientId(),\n      almSettingDto.getClientSecret(), almSettingDto.getPrivateKey(), almSettingDto.getUrl());\n\n    githubApplicationClient.checkApiEndpoint(configuration);\n    return githubApplicationClient.findMissingAppPermissions(configuration, requiredPermissions);\n  }\n\n  private GithubAppConfiguration buildConfiguration(@Nullable String applicationId, @Nullable String clientId, String clientSecret, String privateKey,\n    @Nullable String url) {\n    long appId;\n    try {\n      appId = Long.parseLong(Optional.ofNullable(applicationId).orElseThrow(() -> new IllegalArgumentException(\"Missing appId\")));\n    } catch (NumberFormatException e) {\n      throw new IllegalArgumentException(\"Invalid appId; \" + e.getMessage());\n    }\n    if (isBlank(clientId)) {\n      throw new IllegalArgumentException(\"Missing Client Id\");\n    }\n    if (isBlank(getDecryptedSettingValue(clientSecret))) {\n      throw new IllegalArgumentException(\"Missing Client Secret\");\n    }\n    return new GithubAppConfiguration(appId, getDecryptedSettingValue(privateKey), url);\n  }\n\n  private String getDecryptedSettingValue(String setting) {\n    if (StringUtils.isNotEmpty(setting) && encryption.isEncrypted(setting)) {\n      return encryption.decrypt(setting);\n    }\n    return setting;\n  }\n}\n","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/SonarSource/sonarqube/blob/184c821202192afc1c599fc912d0889b69fffa53/server/sonar-alm-client/src/main/java/org/sonar/alm/client/github/GithubGlobalSettingsValidator.java#L78-L114","documentation":"GithubGlobalSettingsValidator.buildConfiguration parses the GitHub App ID string into a long. If the value is present but not a valid number, this IllegalArgumentException is thrown including the NumberFormatException message. It means the configured appId is malformed.","triggerScenarios":"Calling configuration(...) with an applicationId like 'Iv1.abc123', '12345abc', a Client ID pasted into the App ID field, or extra whitespace/characters.","commonSituations":"Developers confuse the GitHub App ID (numeric, from App settings > About) with the Client ID (starts with Iv1. or Ov23li), copy/paste including invisible characters, or leave a placeholder text in the field.","solutions":["Copy the numeric App ID from GitHub App settings page (About section) — not the Client ID.","Trim whitespace and remove any non-numeric characters from the appId setting.","Re-save the GitHub DevOps platform configuration in SonarQube with the corrected appId.","Verify via the GitHub API: GET /apps/{app-id} should resolve your App."],"exampleFix":"// before\nappId = \"Iv1.8f2a9c1b\"; // Client ID pasted by mistake\n// after\nappId = \"123456\"; // numeric App ID from App settings > About","handlingStrategy":"validation","validationCode":"// client-side guard before saving settings\nfunction isValidAppId(v) { return v != null && /^\\d+$/.test(v.trim()); }\nif (!isValidAppId(applicationId)) throw new Error(\"appId must be numeric (see GitHub App settings > About)\");","typeGuard":"function isNumericAppId(v) { return typeof v === 'string' && /^\\d+$/.test(v.trim()); }","tryCatchPattern":"try { validator.configuration(appId, clientId, secret, key, url); } catch (IllegalArgumentException e) { if (e.getMessage().startsWith(\"Invalid appId\")) { showFieldError(\"appId\", \"Enter the numeric App ID from GitHub App settings\"); } throw e; }","preventionTips":["Never paste the Client Id (Iv1./Ov23li...) into the App ID field","Trim inputs before saving settings","Document where to find the numeric App ID in GitHub UI","Add a form-level numeric-only validation for the appId field"],"tags":["github","validation","configuration","alm-binding"],"backgroundTag":"invalid-argument-format","analyzedSha":"184c821202192afc1c599fc912d0889b69fffa53","analyzedAt":"2026-09-09T12:23:51.573Z","contentChangedAt":"2026-09-09T12:23:51.573Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}