flowable/flowable-engine · error · FlowableIllegalArgumentException
userId and groupId cannot both be null
Error message
userId and groupId cannot both be null
What it means
When adding an identity link to a case definition, at least one of userId or groupId must be provided; both being null means there is no identity to link, so validateParams throws FlowableIllegalArgumentException.
Source
Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/AddIdentityLinkForCaseDefinitionCmd.java:58
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);
return null;
}
View on GitHub (pinned to d6d39ce1c6)
Solutions
- Provide either a userId or a groupId (and a matching identityIdType) for the link
- Validate in the UI/service layer that at least one identity field is set before calling the API
- If neither applies, skip creating the identity link entirely rather than calling with nulls
Example fix
// before
repositoryService.addIdentityLink(defId, userId, groupId, type); // both null
// after
if (userId == null && groupId == null) {
throw new IllegalArgumentException("userId or groupId must be provided");
}
repositoryService.addIdentityLink(defId, userId, groupId, type); Defensive patterns
Strategy: validation
Validate before calling
if (userId == null && groupId == null) throw new IllegalArgumentException("userId or groupId must be provided");
repositoryService.addIdentityLink(defId, userId, groupId, type); Type guard
boolean hasIdentityTarget(String userId, String groupId) { return userId != null || groupId != null; } Try / catch
try {
repositoryService.addIdentityLink(defId, userId, groupId, type);
} catch (FlowableIllegalArgumentException e) {
log.warn("Identity link skipped: {}", e.getMessage());
} Prevention
- Require at least one identity field in forms/DTOs
- Skip link creation when both are absent instead of calling with nulls
- Validate at the service boundary
When it happens
Trigger: Calling cmmnRepositoryService.addIdentityLink(caseDefinitionId, null, null, type) — e.g. both user and group variables null after failed lookups, or a form where neither field was filled.
Common situations: Candidate-starter configuration screens submitting empty user+group, data-migration scripts with blank identity columns, or wrong variable wiring so both arguments bind to null.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- type is required when adding a new task identity link
- Either set the user id or the group id for an identity link,
- taskId is null
- identityId is null
- identityIdType allowed values are 1 and 2
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/ee243c4663658b0d.
Report an issue: GitHub.