{"record":{"id":"820b8397cea6ab3c","repo":"SonarSource/sonarqube","slug":"parameters-severity-and-impact-cannot-be-used","errorCode":null,"errorMessage":"Parameters 'severity' and 'impact' cannot be used at the same time","messagePattern":"Parameters 'severity' and 'impact' cannot be used at the same time","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":400,"severity":"error","filePath":"server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SetSeverityAction.java","lineNumber":220,"sourceCode":"\n  private static String getProjectKey(DefaultIssue issue, SearchResponseData response) {\n    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":202,"sourceCodeEnd":226,"githubUrl":"https://github.com/SonarSource/sonarqube/blob/184c821202192afc1c599fc912d0889b69fffa53/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SetSeverityAction.java#L202-L226","documentation":"Validation guard in SetSeverityAction.checkParams: the api/issues/set_severity web service accepts either the legacy 'severity' parameter or the newer 'impact' parameter, but not both in a single request, since the two would define conflicting severities for the issue. It fires before any issue is loaded, purely from request parameters, so the fix is purely client-side parameter selection.","triggerScenarios":"Calling POST api/issues/set_severity with both severity=MAJOR and impact=RELIABILITY,HIGH in the same request; clients merging query params from old and new integrations.","commonSituations":"Migrating scripts from the classic severity API to the MQR impact API while keeping old parameters; wrapper libraries that always append both fields; form builders collecting both settings.","solutions":["Remove either 'severity' or 'impact' from the request so exactly one is sent","Update wrapper/automation code to prefer 'impact' (or 'severity') consistently","Document the mutual exclusivity in team tooling that builds these requests"],"exampleFix":"// before\npost('/api/issues/set_severity', {issue, severity: 'MAJOR', impact: 'RELIABILITY,HIGH'});\n// after\npost('/api/issues/set_severity', {issue, impact: 'RELIABILITY,HIGH'});","handlingStrategy":"validation","validationCode":"if (severity && impact) throw new Error('pass either severity or impact, not both');\nif (!severity && !impact) throw new Error('pass one of severity or impact');","typeGuard":null,"tryCatchPattern":"try { await post('/api/issues/set_severity', body); } catch (e) { if (e.status === 400 && e.message.includes('cannot be used at the same time')) { /* strip one parameter and retry */ } else throw e; }","preventionTips":["Build request bodies from a single source of truth for severity model","Strip legacy params when migrating to MQR impacts","Add client-side mutual-exclusion checks"],"tags":["sonarqube","issues","webapi","conflicting-parameters"],"backgroundTag":"mutually-exclusive-options","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"}