flowable/flowable-engine · error · FlowableIllegalArgumentException

group is null

Error message

group is null

What it means

SaveGroupCmd persists a Group via the GroupEntityManager (insert for new groups, update for existing ones). A null Group object has no id or state to persist, so the command throws FlowableIllegalArgumentException before touching the entity manager.

Source

Thrown at modules/flowable-idm-engine/src/main/java/org/flowable/idm/engine/impl/cmd/SaveGroupCmd.java:45

 * @author Joram Barrez
 */
public class SaveGroupCmd implements Command<Void>, Serializable {

    private static final long serialVersionUID = 1L;
    
    protected IdmEngineConfiguration idmEngineConfiguration;
    
    protected Group group;

    public SaveGroupCmd(Group group, IdmEngineConfiguration idmEngineConfiguration) {
        this.group = group;
        this.idmEngineConfiguration = idmEngineConfiguration;
    }

    @Override
    public Void execute(CommandContext commandContext) {
        if (group == null) {
            throw new FlowableIllegalArgumentException("group is null");
        }

        if (idmEngineConfiguration.getGroupEntityManager().isNewGroup(group)) {
            if (group instanceof GroupEntity) {
                idmEngineConfiguration.getGroupEntityManager().insert((GroupEntity) group);
            } else {
                CommandContextUtil.getDbSqlSession(commandContext).insert((Entity) group, idmEngineConfiguration.getIdGenerator());
            }
        } else {
            if (group instanceof GroupEntity) {
                idmEngineConfiguration.getGroupEntityManager().update((GroupEntity) group);
            } else {
                CommandContextUtil.getDbSqlSession(commandContext).update((Entity) group);
            }

        }
        return null;
    }

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Ensure the Group instance is created (identityService.newGroup(id)) before saving
  2. Check the preceding lookup/call that produced the null group reference
  3. Guard the save call with a null check to skip or create the group as needed

Example fix

// before
identityService.saveGroup(group);
// after
if (group == null) {
    group = identityService.newGroup(groupId);
}
identityService.saveGroup(group);
Defensive patterns

Strategy: validation

Validate before calling

if (group == null) throw new IllegalArgumentException("group must not be null");

Type guard

boolean isSavableGroup(Group g) { return g != null && g.getId() != null && !g.getId().trim().isEmpty(); }

Try / catch

try { identityService.saveGroup(group); } catch (FlowableIllegalArgumentException e) { log.error("Attempted to save null group", e); }

Prevention

When it happens

Trigger: Calling identityService.saveGroup(null) or executing new SaveGroupCmd(config, null); also when a Group variable is expected from an earlier lookup that returned null.

Common situations: Chaining code like saveGroup(findGroup(name)) where the lookup failed; deserializing groups from JSON/config where the field is missing; Spring injection of a group bean that failed.

Related errors


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