flowable/flowable-engine · error · ActivitiIllegalArgumentException

taskId is null

Error message

taskId is null

What it means

DeleteIdentityLinkCmd removes an identity link (user/group association) from a task, and validateParams rejects a null taskId up front with ActivitiIllegalArgumentException. Identity links are always task-scoped in this command, so the task id is mandatory.

Solutions

  1. Pass the id of the task whose identity link is being removed (task.getId()).
  2. Guard the call site: skip when taskId is null.
  3. Verify you are not accidentally using the process-definition identity link command with task-shaped arguments.

Example fix

// before
taskService.deleteUserIdentityLink(taskId, userId, IdentityLinkType.ASSIGNEE);
// after
if (taskId != null) {
    taskService.deleteUserIdentityLink(taskId, userId, IdentityLinkType.ASSIGNEE);
}
Defensive patterns

Strategy: validation

Validate before calling

if (taskId == null) {
    throw new IllegalArgumentException("taskId required to delete an identity link");
}

Try / catch

try {
    taskService.deleteUserIdentityLink(taskId, userId, type);
} catch (ActivitiIllegalArgumentException e) {
    log.warn("Invalid identity-link delete request: {}", e.getMessage());
}

Prevention

When it happens

Trigger: Calling taskService.deleteUserIdentityLink / deleteGroupIdentityLink (this command) with a null taskId, usually from an unset variable or a wrong method overload.

Common situations: Cleanup code that removes assignments where the task id was never captured; passing a processInstanceId instead of a taskId variable slot; integration code mapping external user data with missing task references.

Related errors


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

Appendix: source

Thrown at modules/flowable5-engine/src/main/java/org/activiti/engine/impl/cmd/DeleteIdentityLinkCmd.java:47

    protected String userId;

    protected String groupId;

    protected String type;

    public DeleteIdentityLinkCmd(String taskId, String userId, String groupId, String type) {
        super(taskId);
        validateParams(userId, groupId, type, taskId);
        this.taskId = taskId;
        this.userId = userId;
        this.groupId = groupId;
        this.type = type;
    }

    protected void validateParams(String userId, String groupId, String type, String taskId) {
        if (taskId == null) {
            throw new ActivitiIllegalArgumentException("taskId is null");
        }

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

        // Special treatment for assignee and owner: group cannot be used and userId may be null
        if (IdentityLinkType.ASSIGNEE.equals(type) || IdentityLinkType.OWNER.equals(type)) {
            if (groupId != null) {
                throw new ActivitiIllegalArgumentException("Incompatible usage: cannot use type '" + type
                        + "' together with a groupId");
            }
        } else {
            if (userId == null && groupId == null) {
                throw new ActivitiIllegalArgumentException("userId and groupId cannot both be null");
            }
        }
    }

View on GitHub (pinned to d6d39ce1c6)