{"record":{"id":"cb69f9716106d51d","repo":"flowable/flowable-engine","slug":"type-is-required-when-adding-a-new-task-identity-l","errorCode":null,"errorMessage":"type is required when adding a new task identity link","messagePattern":"type is required when adding a new task identity link","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-app-engine/src/main/java/org/flowable/app/engine/impl/cmd/AddIdentityLinkCmd.java","lineNumber":52,"sourceCode":"\n    protected String identityType;\n\n    public AddIdentityLinkCmd(String appDefinitionId, String identityId, int identityIdType, String identityType) {\n        super(appDefinitionId);\n        validateParams(appDefinitionId, identityId, identityIdType, identityType);\n        this.appDefinitionId = appDefinitionId;\n        this.identityId = identityId;\n        this.identityIdType = identityIdType;\n        this.identityType = identityType;\n    }\n\n    protected void validateParams(String appDefinitionId, String identityId, int identityIdType, String identityType) {\n        if (appDefinitionId == null) {\n            throw new FlowableIllegalArgumentException(\"appDefinitionId is null\");\n        }\n\n        if (identityType == null) {\n            throw new FlowableIllegalArgumentException(\"type is required when adding a new task identity link\");\n        }\n\n        if (identityId == null) {\n            throw new FlowableIllegalArgumentException(\"identityId is null\");\n        }\n\n        if (identityIdType != IDENTITY_USER && identityIdType != IDENTITY_GROUP) {\n            throw new FlowableIllegalArgumentException(\"identityIdType allowed values are 1 and 2\");\n        }\n    }\n\n    @Override\n    protected Void execute(CommandContext commandContext, AppDefinition appDefinition) {\n\n        if (IDENTITY_USER == identityIdType) {\n            CommandContextUtil.getIdentityLinkService().createScopeIdentityLink(appDefinition.getId(), null, ScopeTypes.APP,\n                            identityId, null, identityType);\n            ","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-app-engine/src/main/java/org/flowable/app/engine/impl/cmd/AddIdentityLinkCmd.java#L34-L70","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Pass a valid identityType constant (e.g. IdentityLinkType.PARTICIPANT / CANDIDATE) in the call.","Populate the type field in your request DTO before invoking Flowable.","Distinguish clearly between identityType (String link type) and identityIdType (int user/group) parameters to avoid mixing them up."],"exampleFix":"// before\nappService.addIdentityLink(appDefinitionId, \"john\", 1, null);\n// after\nappService.addIdentityLink(appDefinitionId, \"john\", IdentityLinkType.USER, IdentityLinkType.PARTICIPANT);","handlingStrategy":"validation","validationCode":"if (identityType == null || identityType.isBlank()) {\n    throw new IllegalArgumentException(\"identityType is required (e.g. participant, candidate)\");\n}","typeGuard":null,"tryCatchPattern":"try { appService.addIdentityLink(appDefId, id, idType, identityType); }\ncatch (FlowableIllegalArgumentException e) { log.error(\"Identity link rejected: \" + e.getMessage()); }","preventionTips":["Use IdentityLinkType constants instead of raw strings","Don't confuse identityType (String) with identityIdType (int)","Map DTO fields explicitly so the type cannot be silently null"],"tags":["null-argument","validation","identity-link"],"backgroundTag":"missing-required-argument","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}