{"record":{"id":"93c620a63c762071","repo":"SonarSource/sonarqube","slug":"missing-parameter-comment","errorCode":null,"errorMessage":"Missing parameter : 'comment'","messagePattern":"Missing parameter : 'comment'","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":400,"severity":"error","filePath":"server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/CommentAction.java","lineNumber":62,"sourceCode":"    comment(properties);\n    return true;\n  }\n\n  @Override\n  public boolean execute(Map<String, Object> properties, Context context) {\n    issueUpdater.addComment(context.issue(), comment(properties), context.issueChangeContext());\n    return true;\n  }\n\n  @Override\n  public boolean shouldRefreshMeasures() {\n    return false;\n  }\n\n  private static String comment(Map<String, Object> properties) {\n    String param = (String) properties.get(COMMENT_PROPERTY);\n    if (Strings.isNullOrEmpty(param)) {\n      throw new IllegalArgumentException(\"Missing parameter : '\" + COMMENT_PROPERTY + \"'\");\n    }\n    return param;\n  }\n}\n","sourceCodeStart":44,"sourceCodeEnd":67,"githubUrl":"https://github.com/SonarSource/sonarqube/blob/184c821202192afc1c599fc912d0889b69fffa53/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/CommentAction.java#L44-L67","documentation":"Thrown by the issue comment action when the 'comment' parameter is missing or empty. Adding a comment requires actual text; SonarQube validates this eagerly and raises IllegalArgumentException (HTTP 400).","triggerScenarios":"Calling POST api/issues/add_comment without the 'comment' parameter, or with comment='' ; also when a client serializes the field but sends an empty string.","commonSituations":"Script with an unquoted shell variable that expands to nothing; form/JSON body omitting the field; UI or bot posting comments where the message template rendered empty.","solutions":["Provide a non-empty 'comment' parameter in the request","Validate the comment text is non-blank in the client before calling the API","Fix shell/env variable expansion so the comment value is not empty"],"exampleFix":"// before\ncurl -X POST '.../api/issues/add_comment?issue=AX1&comment='\n// after\ncurl -X POST '.../api/issues/add_comment?issue=AX1' --data-urlencode 'comment=Please fix before release'","handlingStrategy":"validation","validationCode":"const comment = (message || '').trim();\nif (!comment) throw new Error('comment text is required');","typeGuard":null,"tryCatchPattern":"try { await post('/api/issues/add_comment', {issue, comment}); } catch (e) { if (e.status === 400 && e.message.includes(\"'comment'\")) { /* supply non-empty text */ } else throw e; }","preventionTips":["Trim and check comment text before API calls","Quote shell variables to prevent empty expansion","Use --data-urlencode for form values"],"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"}