{"record":{"id":"c420c41b97e81853","repo":"SonarSource/sonarqube","slug":"the-name-is-missing","errorCode":null,"errorMessage":"The name is missing","messagePattern":"The name is missing","errorType":"http","errorClass":"IllegalArgumentException","httpStatus":400,"severity":"error","filePath":"server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/RuleUpdater.java","lineNumber":164,"sourceCode":"    if (impacts.isEmpty()) {\n      throw new IllegalArgumentException(\"Impacts are is missing\");\n    }\n    impacts.forEach((key, value) -> rule.getDefaultImpacts()\n      .stream()\n      .filter(i -> i.getSoftwareQuality() == key)\n      .findFirst()\n      .ifPresent(i -> {\n        i.setSeverity(value);\n        if (RuleTypeMapper.toRuleType(convertToRuleType(key)) == RuleType.fromDbConstant(rule.getType())) {\n          rule.setSeverity(convertToDeprecatedSeverity(value));\n        }\n      }));\n  }\n\n  private static void updateName(RuleUpdate update, RuleDto rule) {\n    String name = update.getName();\n    if (isNullOrEmpty(name)) {\n      throw new IllegalArgumentException(\"The name is missing\");\n    }\n    rule.setName(name);\n  }\n\n  private void updateDescription(RuleUpdate update, RuleDto rule) {\n    String description = update.getMarkdownDescription();\n    if (isNullOrEmpty(description)) {\n      throw new IllegalArgumentException(\"The description is missing\");\n    }\n    RuleDescriptionSectionDto descriptionSectionDto = createDefaultRuleDescriptionSection(uuidFactory.create(), description);\n    rule.setDescriptionFormat(RuleDto.Format.MARKDOWN);\n    rule.replaceRuleDescriptionSectionDtos(List.of(descriptionSectionDto));\n  }\n\n  private static void updateSeverity(RuleUpdate update, RuleDto rule) {\n    String severity = update.getSeverity();\n    if (isNullOrEmpty(severity) || !Severity.ALL.contains(severity)) {\n      throw new IllegalArgumentException(\"The severity is invalid\");","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/SonarSource/sonarqube/blob/184c821202192afc1c599fc912d0889b69fffa53/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/RuleUpdater.java#L146-L182","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Include a non-empty 'name' parameter in the api/rules/update request","If the name should not change, omit the field entirely only if the flow allows it, otherwise resend the current name","Add client-side validation rejecting empty/whitespace-only names before calling the API"],"exampleFix":"// before\nPOST api/rules/update?key=java:S2076&severity=MAJOR\n// after\nPOST api/rules/update?key=java:S2076&severity=MAJOR&name=Resources+should+be+closed","handlingStrategy":"validation","validationCode":"if (!name || !name.trim()) throw new Error(\"api/rules/update requires a non-empty 'name'\");","typeGuard":"function hasName(p) {\n  return typeof p.name === 'string' && p.name.trim().length > 0;\n}","tryCatchPattern":"try {\n  await post(\"api/rules/update\", params);\n} catch (e) {\n  if (String(e.message).includes(\"The name is missing\")) {\n    console.error(\"Supply a non-empty 'name' parameter for the rule update\");\n  }\n}","preventionTips":["Always include the rule's current name when building conditional update payloads","Trim user input and reject blank names in forms before calling the API","Keep update scripts explicit: list name, description, severity, status together"],"tags":["sonarqube","rules","validation","missing-field"],"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-17T15:17:12.973Z"}