flowable/flowable-engine · error · FlowableIllegalArgumentException
groupId is null
Error message
groupId is null
What it means
CreateMembershipCmd.execute(CommandContext) throws FlowableIllegalArgumentException when its groupId field is null at execution time. Memberships must reference an existing group; a null group id is rejected before touching the entity manager. The constructor validates userId but this check runs when the command executes.
Source
Thrown at modules/flowable-idm-engine/src/main/java/org/flowable/idm/engine/impl/cmd/CreateMembershipCmd.java:43
public class CreateMembershipCmd implements Command<Object>, Serializable {
private static final long serialVersionUID = 1L;
String userId;
String groupId;
public CreateMembershipCmd(String userId, String groupId) {
this.userId = userId;
this.groupId = groupId;
}
@Override
public Object execute(CommandContext commandContext) {
if (userId == null) {
throw new FlowableIllegalArgumentException("userId is null");
}
if (groupId == null) {
throw new FlowableIllegalArgumentException("groupId is null");
}
CommandContextUtil.getMembershipEntityManager(commandContext).createMembership(userId, groupId);
return null;
}
}
View on GitHub (pinned to d6d39ce1c6)
Solutions
- Pass a non-null groupId that references an existing group.
- Create the group first (identityService.newGroup/saveGroup) if it doesn't exist.
- Check group.getId() for null before calling createMembership.
Example fix
// before
identityService.createMembership(userId, group.getId()); // group.getId() null
// after
if (group.getId() == null) {
identityService.saveGroup(group);
}
identityService.createMembership(userId, group.getId()); Defensive patterns
Strategy: validation
Validate before calling
if (userId != null && groupId != null) { identityService.createMembership(userId, groupId); } Type guard
boolean canCreateMembership(String userId, String groupId) { return userId != null && groupId != null; } Try / catch
try { identityService.createMembership(userId, groupId); } catch (FlowableIllegalArgumentException e) { log.error("Membership needs non-null userId and groupId", e); } Prevention
- Create/save the group first so getId() is non-null
- Null-check group.getId() before membership creation
- Fail loudly when a required group cannot be resolved instead of passing null
When it happens
Trigger: Calling identityService.createMembership(userId, null) — the command executes and fails its groupId check.
Common situations: Assignment code resolving the target group from a process variable or LDAP attribute that is missing, yielding null.
Related errors
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/3a3b80ca8d60bc7d.
Report an issue: GitHub.