flowable/flowable-engine · error · FlowableException
Cannot assign a groupId to a task assignment that already…
Error message
Cannot assign a groupId to a task assignment that already has a userId
What it means
IdentityLinkEntityImpl.setGroupId is the counterpart guard: assigning a non-null groupId when userId is already set throws this FlowableException. A runtime identity link must model either a user assignment or a group assignment, not both.
Solutions
- Create separate identity links for user and group assignments.
- Call setUserId(null) before setting a groupId if converting the link type is intentional.
- Fix the source configuration (BPMN candidate settings or assignment handler) so user and group targets never land on the same entity.
Example fix
// before
identityLink.setUserId("kermit");
identityLink.setGroupId("sales"); // throws
// after
identityLink.setUserId(null);
identityLink.setGroupId("sales"); Defensive patterns
Strategy: validation
Validate before calling
if (identityLink.getUserId() != null && groupId != null) {
throw new IllegalArgumentException("Split user and group into separate identity links");
} Try / catch
try {
identityLink.setGroupId(groupId);
} catch (FlowableException e) {
// fall back to creating a fresh IdentityLinkEntity for the group
} Prevention
- Clear userId before converting a link to a group assignment.
- Verify custom assignment listeners do not mutate an existing user link with a group.
When it happens
Trigger: getDefaultIdentityLinks or custom code calling setGroupId on an IdentityLinkEntity whose userId is already non-null, e.g. converting a candidate-user link to a candidate-group link in place.
Common situations: Task definitions with overlapping candidateUser/candidateGroup configuration feeding one link; custom assignment listeners reusing an existing link entity; tests constructing links with both fields set.
Related errors
- Cannot assign a userId to a task assignment that already…
- Cannot assign a groupId to a task assignment that already…
- Cannot assign a userId to a task assignment that already…
- Cannot assign a groupId to a task assignment that already…
- Cannot assign a groupId to a task assignment that already…
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/c3f28f53db073520.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable-identitylink-service/src/main/java/org/flowable/identitylink/service/impl/persistence/entity/IdentityLinkEntityImpl.java:142
}
@Override
public void setUserId(String userId) {
if (this.groupId != null && userId != null) {
throw new FlowableException("Cannot assign a userId to a task assignment that already has a groupId");
}
this.userId = userId;
}
@Override
public String getGroupId() {
return groupId;
}
@Override
public void setGroupId(String groupId) {
if (this.userId != null && groupId != null) {
throw new FlowableException("Cannot assign a groupId to a task assignment that already has a userId");
}
this.groupId = groupId;
}
@Override
public String getTaskId() {
return taskId;
}
@Override
public void setTaskId(String taskId) {
this.taskId = taskId;
}
@Override
public String getProcessInstanceId() {
return processInstanceId;
}View on GitHub (pinned to d6d39ce1c6)