{"record":{"id":"ebc20e51ee934b7d","repo":"flowable/flowable-engine","slug":"comment-text-is-required-ebc20e","errorCode":null,"errorMessage":"Comment text is required.","messagePattern":"Comment text is required\\.","errorType":"http","errorClass":"FlowableIllegalArgumentException","httpStatus":400,"severity":"warning","filePath":"modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/task/TaskCommentCollectionResource.java","lineNumber":70,"sourceCode":"    public List<CommentResponse> getComments(@ApiParam(name = \"taskId\") @PathVariable String taskId) {\n        HistoricTaskInstance task = getHistoricTaskFromRequest(taskId);\n        return restResponseFactory.createRestCommentList(taskService.getTaskComments(task.getId()));\n    }\n\n    @ApiOperation(value = \"Create a new comment on a task\", tags = { \"Task Comments\" }, nickname = \"createTaskComments\", code = 201)\n    @ApiResponses(value = {\n            @ApiResponse(code = 201, message = \"Indicates the comment was created and the result is returned.\"),\n            @ApiResponse(code = 400, message = \"Indicates the comment is missing from the request.\"),\n            @ApiResponse(code = 404, message = \"Indicates the requested task was not found.\")\n    })\n    @PostMapping(value = \"/runtime/tasks/{taskId}/comments\", produces = \"application/json\")\n    @ResponseStatus(HttpStatus.CREATED)\n    public CommentResponse createComment(@ApiParam(name = \"taskId\") @PathVariable String taskId, @RequestBody CommentRequest comment) {\n\n        Task task = getTaskFromRequestWithoutAccessCheck(taskId);\n\n        if (comment.getMessage() == null) {\n            throw new FlowableIllegalArgumentException(\"Comment text is required.\");\n        }\n\n        if (restApiInterceptor != null) {\n            restApiInterceptor.createTaskComment(task, comment);\n        }\n\n        String processInstanceId = null;\n        if (comment.isSaveProcessInstanceId()) {\n            Task taskEntity = taskService.createTaskQuery().taskId(task.getId()).singleResult();\n            processInstanceId = taskEntity.getProcessInstanceId();\n        }\n        Comment createdComment = taskService.addComment(task.getId(), processInstanceId, comment.getMessage());\n\n        return restResponseFactory.createRestComment(createdComment);\n    }\n}\n","sourceCodeStart":52,"sourceCodeEnd":87,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/task/TaskCommentCollectionResource.java#L52-L87","documentation":"Flowable's REST task-comment endpoint rejects comment creation when the request body has no message. FlowableIllegalArgumentException is thrown as a client-error because a comment without text is meaningless in the engine. It maps to a 400 Bad Request response.","triggerScenarios":"POST /runtime/tasks/{taskId}/comments with a JSON body where 'message' is null (e.g. {\"message\": null} or message key omitted).","commonSituations":"Clients sending partial payloads from dynamic UI forms; serialization dropping empty strings mapped to null; middleware rewriting the body and omitting the message field.","solutions":["Include a non-null 'message' field in the POST body, e.g. {\"message\":\"my comment\"}","Validate the comment text client-side before calling the API","Check that your JSON serializer does not drop or null out the message field"],"exampleFix":"// before\n{\"saveMessage\": true}\n// after\n{\"message\": \"Please review this task\", \"saveMessage\": true}","handlingStrategy":"validation","validationCode":"if (!body || typeof body.message !== 'string' || body.message.length === 0) {\n  throw new Error('message is required to create a task comment');\n}\nawait fetch(`/flowable-rest/runtime/tasks/${taskId}/comments`, { method: 'POST', body: JSON.stringify({ message: body.message }) });","typeGuard":null,"tryCatchPattern":"try { ... } catch (e) { if (e.status === 400 && /Comment text is required/.test(e.body.message)) { /* surface field-level validation error */ } else { throw e; } }","preventionTips":["Always send a non-empty 'message' field","Validate the payload shape before the HTTP call","Beware serializers that omit null fields"],"tags":["rest","validation","flowable","missing-field"],"backgroundTag":"missing-required-argument","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}