flowable/flowable-engine · error · FlowableIllegalArgumentException

caseDefinitionId is null

Error message

caseDefinitionId is null

What it means

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.

Solutions

  1. Pass the actual case definition id, resolved via createCaseDefinitionQuery().latestVersion().singleResult().getId().
  2. Null-check the id before invoking the repository service call.

Example fix

// before
repositoryService.deleteGroupIdentityLinkForCaseDefinition(caseDefinitionId, "sales", "candidate");
// after
if (caseDefinitionId == null) throw new IllegalArgumentException("caseDefinitionId required");
repositoryService.deleteGroupIdentityLinkForCaseDefinition(caseDefinitionId, "sales", "candidate");
Defensive patterns

Strategy: type-guard

Validate before calling

Objects.requireNonNull(caseDefinitionId, "caseDefinitionId is required");

Type guard

boolean hasDefinitionId(String id) { return id != null && !id.trim().isEmpty(); }

Try / catch

try { repositoryService.deleteUserIdentityLinkForCaseDefinition(defId, userId, type); } catch (FlowableIllegalArgumentException e) { log.error("Invalid case definition identity link delete: {}", e.getMessage()); }

Prevention

When it happens

Trigger: Calling CmmnRepositoryService.deleteUserIdentityLink/deleteGroupIdentityLinkForCaseDefinition with a null caseDefinitionId, typically from a null/unset variable.

Common situations: 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.

Related errors


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

Appendix: source

Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/DeleteIdentityLinkForCaseDefinitionCmd.java:50

    private static final long serialVersionUID = 1L;

    protected String caseDefinitionId;

    protected String userId;

    protected String groupId;

    public DeleteIdentityLinkForCaseDefinitionCmd(String caseDefinitionId, String userId, String groupId) {
        validateParams(userId, groupId, caseDefinitionId);
        this.caseDefinitionId = caseDefinitionId;
        this.userId = userId;
        this.groupId = groupId;
    }

    protected void validateParams(String userId, String groupId, String caseDefinitionId) {
        if (caseDefinitionId == null) {
            throw new FlowableIllegalArgumentException("caseDefinitionId is null");
        }

        if (userId == null && groupId == null) {
            throw new FlowableIllegalArgumentException("userId and groupId cannot both be null");
        }
    }

    @Override
    public Void execute(CommandContext commandContext) {
        CmmnEngineConfiguration cmmnEngineConfiguration = CommandContextUtil.getCmmnEngineConfiguration(commandContext);
        CaseDefinitionEntity caseDefinition = cmmnEngineConfiguration.getCaseDefinitionEntityManager().findById(caseDefinitionId);

        if (caseDefinition == null) {
            throw new FlowableObjectNotFoundException("Cannot find case definition with id " + caseDefinitionId, CaseDefinition.class);
        }

        cmmnEngineConfiguration.getIdentityLinkServiceConfiguration().getIdentityLinkService()
            .deleteScopeDefinitionIdentityLink(caseDefinition.getId(), ScopeTypes.CMMN, userId, groupId);

View on GitHub (pinned to d6d39ce1c6)