flowable/flowable-engine · warning · FlowableIllegalArgumentException

Comment text is required.

Error message

Comment text is required.

What it means

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.

Source

Thrown at modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/task/TaskCommentCollectionResource.java:70

    public List<CommentResponse> getComments(@ApiParam(name = "taskId") @PathVariable String taskId) {
        HistoricTaskInstance task = getHistoricTaskFromRequest(taskId);
        return restResponseFactory.createRestCommentList(taskService.getTaskComments(task.getId()));
    }

    @ApiOperation(value = "Create a new comment on a task", tags = { "Task Comments" }, nickname = "createTaskComments", code = 201)
    @ApiResponses(value = {
            @ApiResponse(code = 201, message = "Indicates the comment was created and the result is returned."),
            @ApiResponse(code = 400, message = "Indicates the comment is missing from the request."),
            @ApiResponse(code = 404, message = "Indicates the requested task was not found.")
    })
    @PostMapping(value = "/runtime/tasks/{taskId}/comments", produces = "application/json")
    @ResponseStatus(HttpStatus.CREATED)
    public CommentResponse createComment(@ApiParam(name = "taskId") @PathVariable String taskId, @RequestBody CommentRequest comment) {

        Task task = getTaskFromRequestWithoutAccessCheck(taskId);

        if (comment.getMessage() == null) {
            throw new FlowableIllegalArgumentException("Comment text is required.");
        }

        if (restApiInterceptor != null) {
            restApiInterceptor.createTaskComment(task, comment);
        }

        String processInstanceId = null;
        if (comment.isSaveProcessInstanceId()) {
            Task taskEntity = taskService.createTaskQuery().taskId(task.getId()).singleResult();
            processInstanceId = taskEntity.getProcessInstanceId();
        }
        Comment createdComment = taskService.addComment(task.getId(), processInstanceId, comment.getMessage());

        return restResponseFactory.createRestComment(createdComment);
    }
}

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Include a non-null 'message' field in the POST body, e.g. {"message":"my comment"}
  2. Validate the comment text client-side before calling the API
  3. Check that your JSON serializer does not drop or null out the message field

Example fix

// before
{"saveMessage": true}
// after
{"message": "Please review this task", "saveMessage": true}
Defensive patterns

Strategy: validation

Validate before calling

if (!body || typeof body.message !== 'string' || body.message.length === 0) {
  throw new Error('message is required to create a task comment');
}
await fetch(`/flowable-rest/runtime/tasks/${taskId}/comments`, { method: 'POST', body: JSON.stringify({ message: body.message }) });

Try / catch

try { ... } catch (e) { if (e.status === 400 && /Comment text is required/.test(e.body.message)) { /* surface field-level validation error */ } else { throw e; } }

Prevention

When it happens

Trigger: POST /runtime/tasks/{taskId}/comments with a JSON body where 'message' is null (e.g. {"message": null} or message key omitted).

Common situations: Clients sending partial payloads from dynamic UI forms; serialization dropping empty strings mapped to null; middleware rewriting the body and omitting the message field.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/ebc20e51ee934b7d. Report an issue: GitHub.