{"record":{"id":"777e8d734de7051e","repo":"SonarSource/sonarqube","slug":"one-of-the-parameters-severity-or-impact-must","errorCode":null,"errorMessage":"One of the parameters 'severity' or 'impact' must be provided","messagePattern":"One of the parameters 'severity' or 'impact' must be provided","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":400,"severity":"error","filePath":"server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SetSeverityAction.java","lineNumber":222,"sourceCode":"    ComponentDto componentByUuid = response.getComponentByUuid(issue.projectUuid());\n    if (componentByUuid == null) {\n      throw new IllegalStateException(\"Component with uuid \" + issue.projectUuid() + \" not found\");\n    }\n    return componentByUuid.getKey();\n  }\n\n  private static void createImpactsIfMissing(DefaultIssue issue, Map<SoftwareQuality, org.sonar.api.issue.impact.Severity> effectiveImpacts) {\n    if (issue.impacts().isEmpty()) {\n      issue.replaceImpacts(effectiveImpacts);\n      issue.setChanged(true);\n    }\n  }\n\n  private static void checkParams(@Nullable String severity, @Nullable String impact) {\n    if (severity != null && impact != null) {\n      throw new IllegalArgumentException(\"Parameters 'severity' and 'impact' cannot be used at the same time\");\n    } else if (severity == null && impact == null) {\n      throw new IllegalArgumentException(\"One of the parameters 'severity' or 'impact' must be provided\");\n    }\n  }\n}\n","sourceCodeStart":204,"sourceCodeEnd":226,"githubUrl":"https://github.com/SonarSource/sonarqube/blob/184c821202192afc1c599fc912d0889b69fffa53/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SetSeverityAction.java#L204-L226","documentation":"SetSeverityAction requires at least one of 'severity' or 'impact'; a request containing neither cannot express what severity change is intended and is rejected with IllegalArgumentException (HTTP 400).","triggerScenarios":"Calling POST api/issues/set_severity with only the 'issue' parameter, or where severity/impact params were dropped (empty shell variables, stripped query strings).","commonSituations":"Scripts with unset variables interpolating to empty; HTTP clients omitting null/empty params; copying a request template and forgetting to fill in the severity field.","solutions":["Include either severity=MAJOR (classic) or impact=RELIABILITY,HIGH (MQR) in the request","Validate in the client that one of the two values is non-empty before calling","Fix variable expansion so the parameter is not dropped"],"exampleFix":"// before\nconst body = {issue}; // severity missing\n// after\nconst body = {issue, severity: 'MAJOR'}; // or {issue, impact: 'RELIABILITY,HIGH'}","handlingStrategy":"validation","validationCode":"if (!severity && !impact) throw new Error('severity or impact is required');","typeGuard":null,"tryCatchPattern":"try { await post('/api/issues/set_severity', body); } catch (e) { if (e.status === 400 && e.message.includes('must be provided')) { /* prompt for severity then retry */ } else throw e; }","preventionTips":["Validate required params exist before sending","Guard against empty shell/env variable expansion","Use typed request builders requiring severity fields"],"tags":["sonarqube","issues","webapi","missing-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"}