flowable/flowable-engine · error · FlowableIllegalArgumentException
commentId is null
Error message
commentId is null
What it means
GetCommentCmd's constructor validates its argument eagerly: a null commentId immediately throws FlowableIllegalArgumentException when the command object is instantiated, before any command context runs. The comment id is required to look up a single Comment entity.
Solutions
- Pass a valid, non-null comment id obtained from taskService.getProcessInstanceComments() / getTaskComments()
- Add a null/blank check before calling getComment
- If the comment may not exist, still pass the id and handle a null return from the lookup instead of skipping the call
Example fix
// before
Comment c = taskService.getComment(commentId); // commentId possibly null
// after
if (commentId != null) {
Comment c = taskService.getComment(commentId);
} Defensive patterns
Strategy: validation
Validate before calling
if (commentId == null || commentId.isEmpty()) throw new IllegalArgumentException("commentId required");
Comment c = taskService.getComment(commentId); Type guard
boolean hasCommentId(String id) { return id != null && !id.trim().isEmpty(); } Prevention
- Obtain comment ids from comment query results only
- Validate ids at API boundaries handling external payloads
- Keep comment id and task id in clearly named fields
When it happens
Trigger: Calling taskService.getComment(null) or new GetCommentCmd(null) directly; a comment id field that was never set from a preceding API response; refactored code dropping the id parameter.
Common situations: UI passing an unset comment identifier; deserialization of a payload missing the comment id; confusing comment id with task id.
Related errors
- activatedBefore is null
- activity tenant id is null
- after time is null
- after time is null
- app definition tenantId is null
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/d5cfaa94d61bb621.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetCommentCmd.java:36
import org.flowable.common.engine.api.FlowableIllegalArgumentException;
import org.flowable.common.engine.impl.interceptor.Command;
import org.flowable.common.engine.impl.interceptor.CommandContext;
import org.flowable.engine.impl.util.CommandContextUtil;
import org.flowable.engine.task.Comment;
/**
* @author Frederik Heremans
*/
public class GetCommentCmd implements Command<Comment>, Serializable {
private static final long serialVersionUID = 1L;
protected String commentId;
public GetCommentCmd(String commentId) {
this.commentId = commentId;
if (commentId == null) {
throw new FlowableIllegalArgumentException("commentId is null");
}
}
@Override
public Comment execute(CommandContext commandContext) {
return CommandContextUtil.getCommentEntityManager(commandContext).findComment(commentId);
}
}
View on GitHub (pinned to d6d39ce1c6)