SonarSource/sonarqube · error · IllegalArgumentException

Parameter %s is required as there are multiple DevOps Platfo

Error message

Parameter %s is required as there are multiple DevOps Platform configurations.

What it means

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.

Source

Thrown at server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/ImportHelper.java:90

    }
  }

  private AlmSettingDto getAlmSettingDtoFromKey(DbSession dbSession, String almSettingKey) {
    return dbClient.almSettingDao().selectByKey(dbSession, almSettingKey)
      .orElseThrow(() -> new NotFoundException(String.format("DevOps Platform configuration '%s' not found.", almSettingKey)));
  }

  private AlmSettingDto getUniqueAlmSettingDtoForAlm(DbSession dbSession, @Nullable ALM alm) {
    List<AlmSettingDto> almSettingDtos = getAlmSettingDtos(dbSession, alm);

    if (almSettingDtos.isEmpty()) {
      String almString = alm == null ? "" : (alm.name() + " ");
      throw new NotFoundException("There is no " + almString + "configuration for DevOps Platform. Please add one.");
    }
    if (almSettingDtos.size() == 1) {
      return almSettingDtos.get(0);
    }
    throw new IllegalArgumentException(String.format("Parameter %s is required as there are multiple DevOps Platform configurations.", PARAM_ALM_SETTING));
  }

  private List<AlmSettingDto> getAlmSettingDtos(DbSession dbSession, @Nullable ALM alm) {
    if (alm == null) {
      return dbClient.almSettingDao().selectAll(dbSession);
    }
    return dbClient.almSettingDao().selectByAlm(dbSession, alm);
  }

  public String getUserUuid() {
    return requireNonNull(userSession.getUuid(), "User UUID cannot be null.");
  }

  public static CreateWsResponse toCreateResponse(ProjectDto projectDto) {
    return newBuilder()
      .setProject(Project.newBuilder()
        .setKey(projectDto.getKey())
        .setName(projectDto.getName())

View on GitHub (pinned to 184c821202)

Solutions

  1. Add the almSetting request parameter with the exact key of the configuration to use
  2. List existing keys via Administration > DevOps Platform Integrations or the settings table and pick one
  3. Remove or consolidate duplicate configurations if only one is wanted

Example fix

// before
request.param(ALM_SETTING) // omitted -> ambiguous
// after
Request.build().setParam("almSetting", "my-github-config").post()
Defensive patterns

Strategy: validation

Validate before calling

const settings = await ws.get('api/alm_settings/list');
if (settings.almSettings.length > 1 && !params.almSetting) {
  throw new Error('Multiple DevOps Platform configs exist; pass almSetting: ' + settings.almSettings.map(s=>s.key).join(','));
}

Type guard

const isAmbiguous = (n) => n > 1;

Try / catch

try {
  await ws.post('api/alm_settings/set_pat', params);
} catch (e) {
  if (e.status === 400 && /multiple DevOps Platform configurations/.test(e.message)) {
    params.almSetting = pickSettingKey();
  } else { throw e; }
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of SonarSource/sonarqube@184c821202 (2026-09-09). Data as JSON: /api/errors/12cc6a1afb471c7c. Report an issue: GitHub.