{"record":{"id":"cec2af149e50a76b","repo":"flowable/flowable-engine","slug":"casedefinitionid-is-null-cec2af","errorCode":null,"errorMessage":"caseDefinitionId is null","messagePattern":"caseDefinitionId is null","errorType":"exception","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/DeleteIdentityLinkForCaseDefinitionCmd.java","lineNumber":50,"sourceCode":"\n    private static final long serialVersionUID = 1L;\n\n    protected String caseDefinitionId;\n\n    protected String userId;\n\n    protected String groupId;\n\n    public DeleteIdentityLinkForCaseDefinitionCmd(String caseDefinitionId, String userId, String groupId) {\n        validateParams(userId, groupId, caseDefinitionId);\n        this.caseDefinitionId = caseDefinitionId;\n        this.userId = userId;\n        this.groupId = groupId;\n    }\n\n    protected void validateParams(String userId, String groupId, String caseDefinitionId) {\n        if (caseDefinitionId == null) {\n            throw new FlowableIllegalArgumentException(\"caseDefinitionId is null\");\n        }\n\n        if (userId == null && groupId == null) {\n            throw new FlowableIllegalArgumentException(\"userId and groupId cannot both be null\");\n        }\n    }\n\n    @Override\n    public Void execute(CommandContext commandContext) {\n        CmmnEngineConfiguration cmmnEngineConfiguration = CommandContextUtil.getCmmnEngineConfiguration(commandContext);\n        CaseDefinitionEntity caseDefinition = cmmnEngineConfiguration.getCaseDefinitionEntityManager().findById(caseDefinitionId);\n\n        if (caseDefinition == null) {\n            throw new FlowableObjectNotFoundException(\"Cannot find case definition with id \" + caseDefinitionId, CaseDefinition.class);\n        }\n\n        cmmnEngineConfiguration.getIdentityLinkServiceConfiguration().getIdentityLinkService()\n            .deleteScopeDefinitionIdentityLink(caseDefinition.getId(), ScopeTypes.CMMN, userId, groupId);","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/DeleteIdentityLinkForCaseDefinitionCmd.java#L32-L68","documentation":"DeleteIdentityLinkForCaseDefinitionCmd.validateParams throws FlowableIllegalArgumentException when caseDefinitionId is null. Identity links (start-form users/groups etc.) are attached to a specific case definition, so its id is required.","triggerScenarios":"Calling CmmnRepositoryService.deleteUserIdentityLink/deleteGroupIdentityLinkForCaseDefinition with a null caseDefinitionId, typically from a null/unset variable.","commonSituations":"UI/form handlers where the definition id field was never filled; generic admin tooling that applies the same call across process and case definitions and passes null for the case case.","solutions":["Pass the actual case definition id, resolved via createCaseDefinitionQuery().latestVersion().singleResult().getId().","Null-check the id before invoking the repository service call."],"exampleFix":"// before\nrepositoryService.deleteGroupIdentityLinkForCaseDefinition(caseDefinitionId, \"sales\", \"candidate\");\n// after\nif (caseDefinitionId == null) throw new IllegalArgumentException(\"caseDefinitionId required\");\nrepositoryService.deleteGroupIdentityLinkForCaseDefinition(caseDefinitionId, \"sales\", \"candidate\");","handlingStrategy":"type-guard","validationCode":"Objects.requireNonNull(caseDefinitionId, \"caseDefinitionId is required\");","typeGuard":"boolean hasDefinitionId(String id) { return id != null && !id.trim().isEmpty(); }","tryCatchPattern":"try { repositoryService.deleteUserIdentityLinkForCaseDefinition(defId, userId, type); } catch (FlowableIllegalArgumentException e) { log.error(\"Invalid case definition identity link delete: {}\", e.getMessage()); }","preventionTips":["Resolve definition ids from CaseDefinitionQuery, never nullable inputs.","Validate parameters at the service boundary."],"tags":["cmmn","identity-link","null-argument","java"],"backgroundTag":"null-argument","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}