flowable/flowable-engine · error · FlowableIllegalArgumentException

type is required when adding a new task identity link

Error message

type is required when adding a new task identity link

What it means

validateParams in AddIdentityLinkCmd also requires identityType (e.g. "user"/"group" participation type) to be non-null when adding an identity link. The message text mentions "task identity link" but the command is for app definitions; it simply means the link's type discriminator was not supplied.

Source

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

    protected String identityType;

    public AddIdentityLinkCmd(String appDefinitionId, String identityId, int identityIdType, String identityType) {
        super(appDefinitionId);
        validateParams(appDefinitionId, identityId, identityIdType, identityType);
        this.appDefinitionId = appDefinitionId;
        this.identityId = identityId;
        this.identityIdType = identityIdType;
        this.identityType = identityType;
    }

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

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

        if (identityId == null) {
            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, AppDefinition appDefinition) {

        if (IDENTITY_USER == identityIdType) {
            CommandContextUtil.getIdentityLinkService().createScopeIdentityLink(appDefinition.getId(), null, ScopeTypes.APP,
                            identityId, null, identityType);
            

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Pass a valid identityType constant (e.g. IdentityLinkType.PARTICIPANT / CANDIDATE) in the call.
  2. Populate the type field in your request DTO before invoking Flowable.
  3. Distinguish clearly between identityType (String link type) and identityIdType (int user/group) parameters to avoid mixing them up.

Example fix

// before
appService.addIdentityLink(appDefinitionId, "john", 1, null);
// after
appService.addIdentityLink(appDefinitionId, "john", IdentityLinkType.USER, IdentityLinkType.PARTICIPANT);
Defensive patterns

Strategy: validation

Validate before calling

if (identityType == null || identityType.isBlank()) {
    throw new IllegalArgumentException("identityType is required (e.g. participant, candidate)");
}

Try / catch

try { appService.addIdentityLink(appDefId, id, idType, identityType); }
catch (FlowableIllegalArgumentException e) { log.error("Identity link rejected: " + e.getMessage()); }

Prevention

When it happens

Trigger: Calling the identity-link API with identityType == null (forgetting to pass IdentityLinkType.USER/GROUP or the string "candidate"/"participant"), while appDefinitionId and identityId are set.

Common situations: Mapping a DTO to the API call where the type field was not populated; confusing identityIdType (int user/group flag) with identityType (link type string) and only setting one.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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