flowable/flowable-engine · error · FlowableIllegalArgumentException

identityId is null

Error message

identityId is null

What it means

AddIdentityLinkCmd requires identityId (the user or group id) to be non-null unless the link type is ASSIGNEE or OWNER added as user-type where the id is implied by context. When identityId is null and the type demands one (groups, or any type other than assignee/owner), FlowableIllegalArgumentException is thrown.

Source

Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/AddIdentityLinkCmd.java:62

        this.taskId = taskId;
        this.identityId = identityId;
        this.identityIdType = identityIdType;
        this.identityType = identityType;
    }

    protected void validateParams(String taskId, String identityId, int identityIdType, String identityType) {
        if (taskId == null) {
            throw new FlowableIllegalArgumentException("taskId is null");
        }

        if (identityType == null) {
            throw new FlowableIllegalArgumentException("type is required when adding a new task identity link");
        }

        if (identityId == null && (identityIdType == IDENTITY_GROUP ||
                (!IdentityLinkType.ASSIGNEE.equals(identityType) && !IdentityLinkType.OWNER.equals(identityType)))) {

            throw new FlowableIllegalArgumentException("identityId is null");
        }

        if (identityIdType != IDENTITY_USER && identityIdType != IDENTITY_GROUP) {
            throw new FlowableIllegalArgumentException("identityIdType allowed values are 1 and 2");
        }
    }

    @Override
    protected Void execute(CommandContext commandContext, TaskEntity task) {
        CmmnEngineConfiguration cmmnEngineConfiguration = CommandContextUtil.getCmmnEngineConfiguration(commandContext);
        
        String oldAssigneeId = task.getAssignee();
        String oldOwnerId = task.getOwner();
        
        boolean assignedToNoOne = false;
        if (IdentityLinkType.ASSIGNEE.equals(identityType)) {
            
            if (oldAssigneeId == null && identityId == null) {

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Resolve and pass the actual user/group id; verify it is non-null before the call
  2. Use setAssignee/setOwner instead of addIdentityLink when the intent is assignee/owner without an explicit identity lookup
  3. Validate input at the API boundary so null identity ids are rejected with a clear message

Example fix

// before
taskService.addGroupIdentityLink(taskId, groupId, IdentityLinkType.PARTICIPANT); // groupId == null
// after
if (groupId == null) throw new IllegalArgumentException("groupId is required");
taskService.addGroupIdentityLink(taskId, groupId, IdentityLinkType.PARTICIPANT);
Defensive patterns

Strategy: validation

Validate before calling

if (identityId == null && !IdentityLinkType.ASSIGNEE.equals(type) && !IdentityLinkType.OWNER.equals(type)) {
    throw new IllegalArgumentException("identityId is required for type " + type);
}

Type guard

boolean hasIdentity(String id, String type) {
    return id != null || IdentityLinkType.ASSIGNEE.equals(type) || IdentityLinkType.OWNER.equals(type);
}

Try / catch

try {
    taskService.addGroupIdentityLink(taskId, groupId, type);
} catch (FlowableIllegalArgumentException e) {
    throw new BadRequestException("Missing user/group id: " + e.getMessage());
}

Prevention

When it happens

Trigger: Calling cmmnTaskService.addGroupIdentityLink(taskId, null, type), or addUserIdentityLink with a null userId for a type other than ASSIGNEE/OWNER — i.e. the resolved user/group id was null.

Common situations: User directory lookup returned no match so the id variable stayed null, form/DTO omitted the identity field, or a caller confused userId/group arguments and passed null.

Related errors


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