{"record":{"id":"e3ac1eb55a1da5f2","repo":"flowable/flowable-engine","slug":"appdefinitionid-is-null","errorCode":null,"errorMessage":"appDefinitionId is null","messagePattern":"appDefinitionId is null","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":48,"sourceCode":"\n    protected String identityId;\n\n    protected int identityIdType;\n\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","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-app-engine/src/main/java/org/flowable/app/engine/impl/cmd/AddIdentityLinkCmd.java#L30-L66","documentation":"AddIdentityLinkCmd.validateParams() requires a non-null appDefinitionId when adding an identity link to an app definition. A null id means there is no target definition, so the command fails fast with FlowableIllegalArgumentException before touching the database.","triggerScenarios":"Executing AddIdentityLinkCmd (via AppIdentityService/TaskService-style identity link APIs) with appDefinitionId == null, e.g. passing an unset variable or the result of a failed lookup straight into addIdentityLink.","commonSituations":"Calling runtimeService/appService identity-link APIs with a variable that was never populated; missing null checks in controller/service code before delegating to Flowable.","solutions":["Obtain a valid appDefinitionId (e.g. from the AppDefinition or deployment) before adding the identity link.","Add a null/empty check on the id in your calling code and fail with a clear business error.","If the id comes from a request parameter, validate it at the API boundary."],"exampleFix":"// before\nidentityService.addIdentityLink(appDefinitionId, userId, IdentityLinkType.PARTICIPANT);\n// after\nif (appDefinitionId == null) {\n    throw new IllegalArgumentException(\"appDefinitionId must be provided\");\n}\nidentityService.addIdentityLink(appDefinitionId, userId, IdentityLinkType.PARTICIPANT);","handlingStrategy":"validation","validationCode":"if (appDefinitionId == null || appDefinitionId.isBlank()) {\n    throw new IllegalArgumentException(\"appDefinitionId is required\");\n}","typeGuard":null,"tryCatchPattern":"try { identityService.addIdentityLink(appDefinitionId, userId, type); }\ncatch (FlowableIllegalArgumentException e) { log.error(\"Identity link rejected: \" + e.getMessage()); }","preventionTips":["Validate ids at the API/controller boundary","Never pass lookup results without a null check","Fetch the AppDefinition first and use its id"],"tags":["null-argument","validation","identity-link"],"backgroundTag":"null-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"}