flowable/flowable-engine · error · FlowableException
Cannot add a comment to a suspended {execution}
Error message
Cannot add a comment to a suspended {execution} What it means
FlowableException thrown by AddCommentCmd.execute when the process instance execution exists but is suspended. Comments cannot be added to suspended process instances; the instance must be activated first.
Source
Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/AddCommentCmd.java:82
if (task == null) {
throw new FlowableObjectNotFoundException("Cannot find task with id " + taskId, Task.class);
}
if (task.isSuspended()) {
throw new FlowableException("Cannot add a comment to a suspended " + task);
}
}
ExecutionEntity execution = null;
if (processInstanceId != null) {
execution = processEngineConfiguration.getExecutionEntityManager().findById(processInstanceId);
if (execution == null) {
throw new FlowableObjectNotFoundException("execution " + processInstanceId + " doesn't exist", Execution.class);
}
if (execution.isSuspended()) {
throw new FlowableException("Cannot add a comment to a suspended " + execution);
}
}
String processDefinitionId = null;
if (execution != null) {
processDefinitionId = execution.getProcessDefinitionId();
} else if (task != null) {
processDefinitionId = task.getProcessDefinitionId();
}
if (Flowable5Util.isFlowable5ProcessDefinitionId(commandContext, processDefinitionId)) {
Flowable5CompatibilityHandler compatibilityHandler = Flowable5Util.getFlowable5CompatibilityHandler();
return compatibilityHandler.addComment(taskId, processInstanceId, type, message);
}
String userId = Authentication.getAuthenticatedUserId();
CommentEntity comment = processEngineConfiguration.getCommentEntityManager().create();
comment.setUserId(userId);View on GitHub (pinned to d6d39ce1c6)
Solutions
- Activate the process instance first: runtimeService.activateProcessInstanceById(processInstanceId), then add the comment.
- If suspension came from the process definition, activate the definition: runtimeService.activateProcessInstanceByKey(key).
- Check execution.isSuspended() (processInstanceQuery().suspended()/active()) before commenting.
- Catch FlowableException and defer/queue comments until the instance is active.
Example fix
// before
taskService.addComment(null, processInstanceId, msg);
// after
if (runtimeService.createProcessInstanceQuery()
.processInstanceId(processInstanceId).active().singleResult() != null) {
taskService.addComment(null, processInstanceId, msg);
} else {
runtimeService.activateProcessInstanceById(processInstanceId);
taskService.addComment(null, processInstanceId, msg);
} Defensive patterns
Strategy: try-catch
Validate before calling
if (runtimeService.createProcessInstanceQuery()
.processInstanceId(processInstanceId).suspended().singleResult() != null) {
runtimeService.activateProcessInstanceById(processInstanceId);
} Try / catch
try {
taskService.addComment(null, processInstanceId, msg);
} catch (FlowableException e) {
// queue and retry after the instance is activated
commentQueue.add(new PendingComment(processInstanceId, msg));
} Prevention
- Gate comment integrations on instance active state.
- Activate suspended instances before resuming automation.
- Use active() filters in process instance queries before writes.
When it happens
Trigger: taskService.addComment(null, processInstanceId, message) while the instance is suspended via runtimeService.suspendProcessInstanceById or a suspended process definition.
Common situations: Workflow paused for maintenance or business hold while integrations keep posting comments; scheduled comment jobs overlapping a suspension window.
Understand the failure class
Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.
Related errors
- Cannot add a comment to a suspended {task}
- execution {processInstanceId} doesn't exist
- process instance ${processInstanceId} is suspended, cannot s
- Could not start process instance with business key ${key}
- Job <jobId> parent is not process instance
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/b555e32e4ba0afec.
Report an issue: GitHub.