flowable/flowable-engine · error · FlowableIllegalArgumentException
caseDefinitionId is null
Error message
caseDefinitionId is null
What it means
AddIdentityLinkForCaseDefinitionCmd attaches identity links (candidate starter users/groups) to a case definition, and validateParams requires a non-null caseDefinitionId. Without it there is no definition to attach to, so FlowableIllegalArgumentException is thrown.
Source
Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/AddIdentityLinkForCaseDefinitionCmd.java:54
protected String caseDefinitionId;
protected String userId;
protected String groupId;
public AddIdentityLinkForCaseDefinitionCmd(String caseDefinitionId, String userId, String groupId,
CmmnEngineConfiguration cmmnEngineConfiguration) {
validateParams(userId, groupId, caseDefinitionId);
this.caseDefinitionId = caseDefinitionId;
this.userId = userId;
this.groupId = groupId;
this.cmmnEngineConfiguration = cmmnEngineConfiguration;
}
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) {
CaseDefinitionEntity caseDefinition = cmmnEngineConfiguration.getCaseDefinitionEntityManager().findById(caseDefinitionId);
if (caseDefinition == null) {
throw new FlowableObjectNotFoundException("Cannot find case definition with id " + caseDefinitionId, CaseDefinition.class);
}
IdentityLinkEntity identityLinkEntity = cmmnEngineConfiguration.getIdentityLinkServiceConfiguration().getIdentityLinkService()
.createScopeDefinitionIdentityLink(caseDefinition.getId(), ScopeTypes.CMMN, userId, groupId);
caseDefinition.getIdentityLinks().add(identityLinkEntity);View on GitHub (pinned to d6d39ce1c6)
Solutions
- Obtain the id via cmmnRepositoryService.createCaseDefinitionQuery().caseDefinitionKey(key).latestVersion().singleResult() and null-check it before linking
- Validate inputs at the caller and return a 4xx-style message when the definition id is absent
- Pass the latest deployed definition id explicitly after deployment
Example fix
// before
repositoryService.addIdentityLink(caseDefinitionId, userId, null, IdentityLinkType.CANDIDATE_STARTER);
// after
if (caseDefinitionId == null) throw new IllegalArgumentException("caseDefinitionId is required");
repositoryService.addIdentityLink(caseDefinitionId, userId, null, IdentityLinkType.CANDIDATE_STARTER); Defensive patterns
Strategy: validation
Validate before calling
if (caseDefinitionId == null) throw new IllegalArgumentException("caseDefinitionId is required");
repositoryService.addIdentityLink(caseDefinitionId, userId, groupId, type); Type guard
boolean hasDefinitionId(String id) { return id != null && !id.isBlank(); } Try / catch
try {
repositoryService.addIdentityLink(defId, userId, groupId, type);
} catch (FlowableIllegalArgumentException e) {
throw new BadRequestException("caseDefinitionId missing: " + e.getMessage());
} Prevention
- Resolve the id from a CaseDefinitionQuery before linking
- Null-check ids arriving from REST/DTO layers
- Never pass ids captured before a redeploy without re-validating
When it happens
Trigger: Calling cmmnRepositoryService.addIdentityLink(caseDefinitionId, userId, groupId, type) with a null caseDefinitionId, e.g. when the id came from a failed deployment lookup or an unset request parameter.
Common situations: Case definition lookup by key returning null and the null being passed on, REST payloads missing the definition id, or code assuming a default definition exists.
Related errors
- taskId is null
- identityId is null
- caseInstanceId is null
- Case definition keys is null
- The case instance with id '${caseInstanceId}' could not be f
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/ea78ad564cfa1af6.
Report an issue: GitHub.