SonarSource/sonarqube · error · IllegalArgumentException

The name is missing

Error message

The name is missing

What it means

RuleUpdater.updateName validates that the update carries a non-null, non-empty rule name; if update.getName() is null or empty the update is aborted with IllegalArgumentException('The name is missing') because every rule must have a display name.

Solutions

  1. Include a non-empty 'name' parameter in the api/rules/update request
  2. If the name should not change, omit the field entirely only if the flow allows it, otherwise resend the current name
  3. Add client-side validation rejecting empty/whitespace-only names before calling the API

Example fix

// before
POST api/rules/update?key=java:S2076&severity=MAJOR
// after
POST api/rules/update?key=java:S2076&severity=MAJOR&name=Resources+should+be+closed
Defensive patterns

Strategy: validation

Validate before calling

if (!name || !name.trim()) throw new Error("api/rules/update requires a non-empty 'name'");

Type guard

function hasName(p) {
  return typeof p.name === 'string' && p.name.trim().length > 0;
}

Try / catch

try {
  await post("api/rules/update", params);
} catch (e) {
  if (String(e.message).includes("The name is missing")) {
    console.error("Supply a non-empty 'name' parameter for the rule update");
  }
}

Prevention

When it happens

Trigger: Calling api/rules/update with 'name' omitted or set to an empty/blank string while other fields are being updated in MARKDOWN/custom-rule flows that require a name.

Common situations: Automation scripts building the update payload conditionally and forgetting the name; UI/API clients sending name="" after clearing a text field; copy-pasted request templates with the name parameter removed.

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/c420c41b97e81853. Report an issue: GitHub.

Appendix: source

Thrown at server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/RuleUpdater.java:164

    if (impacts.isEmpty()) {
      throw new IllegalArgumentException("Impacts are is missing");
    }
    impacts.forEach((key, value) -> rule.getDefaultImpacts()
      .stream()
      .filter(i -> i.getSoftwareQuality() == key)
      .findFirst()
      .ifPresent(i -> {
        i.setSeverity(value);
        if (RuleTypeMapper.toRuleType(convertToRuleType(key)) == RuleType.fromDbConstant(rule.getType())) {
          rule.setSeverity(convertToDeprecatedSeverity(value));
        }
      }));
  }

  private static void updateName(RuleUpdate update, RuleDto rule) {
    String name = update.getName();
    if (isNullOrEmpty(name)) {
      throw new IllegalArgumentException("The name is missing");
    }
    rule.setName(name);
  }

  private void updateDescription(RuleUpdate update, RuleDto rule) {
    String description = update.getMarkdownDescription();
    if (isNullOrEmpty(description)) {
      throw new IllegalArgumentException("The description is missing");
    }
    RuleDescriptionSectionDto descriptionSectionDto = createDefaultRuleDescriptionSection(uuidFactory.create(), description);
    rule.setDescriptionFormat(RuleDto.Format.MARKDOWN);
    rule.replaceRuleDescriptionSectionDtos(List.of(descriptionSectionDto));
  }

  private static void updateSeverity(RuleUpdate update, RuleDto rule) {
    String severity = update.getSeverity();
    if (isNullOrEmpty(severity) || !Severity.ALL.contains(severity)) {
      throw new IllegalArgumentException("The severity is invalid");

View on GitHub (pinned to 184c821202)