SonarSource/sonarqube · error · NotFoundException

There is no ${alm} configuration for DevOps Platform. Please

Error message

There is no ${alm} configuration for DevOps Platform. Please add one.

What it means

NotFoundException thrown by ImportHelper.getUniqueAlmSettingDtoForAlm when the SonarQube instance has zero DevOps Platform (ALM) configurations matching the requested ALM type (or none at all when alm is null). The server cannot resolve a unique ALM setting to import projects from, so the WS call is rejected with 404 and a message telling the admin to add a configuration.

Source

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

      String almSettingKey = request.param(PARAM_ALM_SETTING);
      if (almSettingKey != null) {
        return getAlmSettingDtoFromKey(dbSession, almSettingKey);
      }
      return getUniqueAlmSettingDtoForAlm(dbSession, alm);
    }
  }

  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.");
  }

View on GitHub (pinned to 184c821202)

Solutions

  1. Go to Administration > DevOps Platform Integrations and create a configuration for the ALM in question before retrying the import
  2. If multiple configurations exist, pass the almSetting parameter naming the desired setting key
  3. Verify the alm parameter spelling matches an ALM you actually configured
  4. Check sonar.alm.allowMultiple feature state if you expect more than one setting

Example fix

// before
curl -u token: 'POST /api/alm_integrations/import_project?url=...'
// after
# first configure the DevOps Platform in Administration, or specify the setting
curl -u token: 'POST /api/alm_integrations/import_project?url=...&almSetting=my-azure-setting'
Defensive patterns

Strategy: validation

Validate before calling

const settings = await ws.get('api/alm_settings/list');
const matching = settings.almSettings.filter(s => !alm || s.alm === alm);
if (matching.length === 0) throw new Error(`Configure a ${alm ?? ''} DevOps Platform before importing`);
if (matching.length > 1 && !almSetting) throw new Error('almSetting param required');

Type guard

const hasAlmSetting = (s) => s && typeof s.key === 'string' && s.key.length > 0;

Try / catch

try {
  await ws.post('api/alm_integrations/import_project', params);
} catch (e) {
  if (e.status === 404 && /no .*configuration for DevOps Platform/.test(e.message)) {
    throw new Error('Admin must add a DevOps Platform configuration first');
  }
  throw e;
}

Prevention

When it happens

Trigger: Calling a web service that uses getAlmSettingDto (e.g. project import from Azure/GitLab/etc.) without passing the almSetting parameter when no configuration of the requested ALM type exists in ALM_SETTINGS table.

Common situations: Fresh SonarQube install where no DevOps Platform integration was ever configured; the integration was deleted before running an import; passing an alm parameter whose type has no settings while other ALMs are configured.

Related errors


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