{"record":{"id":"12cc6a1afb471c7c","repo":"SonarSource/sonarqube","slug":"parameter-s-is-required-as-there-are-multiple-dev","errorCode":null,"errorMessage":"Parameter %s is required as there are multiple DevOps Platform configurations.","messagePattern":"Parameter (.+?) is required as there are multiple DevOps Platform configurations\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":400,"severity":"error","filePath":"server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/ImportHelper.java","lineNumber":90,"sourceCode":"    }\n  }\n\n  private AlmSettingDto getAlmSettingDtoFromKey(DbSession dbSession, String almSettingKey) {\n    return dbClient.almSettingDao().selectByKey(dbSession, almSettingKey)\n      .orElseThrow(() -> new NotFoundException(String.format(\"DevOps Platform configuration '%s' not found.\", almSettingKey)));\n  }\n\n  private AlmSettingDto getUniqueAlmSettingDtoForAlm(DbSession dbSession, @Nullable ALM alm) {\n    List<AlmSettingDto> almSettingDtos = getAlmSettingDtos(dbSession, alm);\n\n    if (almSettingDtos.isEmpty()) {\n      String almString = alm == null ? \"\" : (alm.name() + \" \");\n      throw new NotFoundException(\"There is no \" + almString + \"configuration for DevOps Platform. Please add one.\");\n    }\n    if (almSettingDtos.size() == 1) {\n      return almSettingDtos.get(0);\n    }\n    throw new IllegalArgumentException(String.format(\"Parameter %s is required as there are multiple DevOps Platform configurations.\", PARAM_ALM_SETTING));\n  }\n\n  private List<AlmSettingDto> getAlmSettingDtos(DbSession dbSession, @Nullable ALM alm) {\n    if (alm == null) {\n      return dbClient.almSettingDao().selectAll(dbSession);\n    }\n    return dbClient.almSettingDao().selectByAlm(dbSession, alm);\n  }\n\n  public String getUserUuid() {\n    return requireNonNull(userSession.getUuid(), \"User UUID cannot be null.\");\n  }\n\n  public static CreateWsResponse toCreateResponse(ProjectDto projectDto) {\n    return newBuilder()\n      .setProject(Project.newBuilder()\n        .setKey(projectDto.getKey())\n        .setName(projectDto.getName())","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/SonarSource/sonarqube/blob/184c821202192afc1c599fc912d0889b69fffa53/server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/ImportHelper.java#L72-L108","documentation":"IllegalArgumentException thrown by ImportHelper.getUniqueAlmSettingDtoForAlm when more than one DevOps Platform configuration of the requested ALM type exists and the caller did not specify which one via the almSetting parameter. The server refuses to guess between ambiguous configurations.","triggerScenarios":"Calling an import/config web service without the almSetting parameter while two or more ALM settings exist for the given ALM (or across all ALMs when alm is null).","commonSituations":"Admins created a second Azure DevOps or GitHub configuration after enabling the multiple-ALM feature; scripts written for single-config instances break after a second configuration is added.","solutions":["Add the almSetting request parameter with the exact key of the configuration to use","List existing keys via Administration > DevOps Platform Integrations or the settings table and pick one","Remove or consolidate duplicate configurations if only one is wanted"],"exampleFix":"// before\nrequest.param(ALM_SETTING) // omitted -> ambiguous\n// after\nRequest.build().setParam(\"almSetting\", \"my-github-config\").post()","handlingStrategy":"validation","validationCode":"const settings = await ws.get('api/alm_settings/list');\nif (settings.almSettings.length > 1 && !params.almSetting) {\n  throw new Error('Multiple DevOps Platform configs exist; pass almSetting: ' + settings.almSettings.map(s=>s.key).join(','));\n}","typeGuard":"const isAmbiguous = (n) => n > 1;","tryCatchPattern":"try {\n  await ws.post('api/alm_settings/set_pat', params);\n} catch (e) {\n  if (e.status === 400 && /multiple DevOps Platform configurations/.test(e.message)) {\n    params.almSetting = pickSettingKey();\n  } else { throw e; }\n}","preventionTips":["Always pass almSetting once more than one configuration can exist","Keep configuration-as-code keys unique and documented","Audit ALM_SETTINGS for duplicates before scripting"],"tags":["sonarqube","webapi","ambiguous-config","required-parameter"],"backgroundTag":"missing-required-argument","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"}