flowable/flowable-engine · error · FlowableIllegalArgumentException
The case instance id is mandatory, but '${caseInstanceId}' h
Error message
The case instance id is mandatory, but '${caseInstanceId}' has not been provided. What it means
Constructor validation in SetCaseInstanceDueDateCmd: a null or empty caseInstanceId is rejected before any command executes, throwing FlowableIllegalArgumentException. Flowable commands validate their mandatory arguments eagerly so the error surfaces at call time rather than deep inside the command context.
Source
Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/SetCaseInstanceDueDateCmd.java:36
import org.flowable.cmmn.api.runtime.CaseInstance;
import org.flowable.cmmn.engine.impl.persistence.entity.CaseInstanceEntity;
import org.flowable.cmmn.engine.impl.persistence.entity.CaseInstanceEntityManager;
import org.flowable.cmmn.engine.impl.util.CommandContextUtil;
import org.flowable.common.engine.api.FlowableIllegalArgumentException;
import org.flowable.common.engine.api.FlowableObjectNotFoundException;
import org.flowable.common.engine.impl.interceptor.Command;
import org.flowable.common.engine.impl.interceptor.CommandContext;
public class SetCaseInstanceDueDateCmd implements Command<Void>, Serializable {
private static final long serialVersionUID = 1L;
private final String caseInstanceId;
private final Date dueDate;
public SetCaseInstanceDueDateCmd(String caseInstanceId, Date dueDate) {
if (caseInstanceId == null || caseInstanceId.length() < 1) {
throw new FlowableIllegalArgumentException("The case instance id is mandatory, but '" + caseInstanceId + "' has not been provided.");
}
this.caseInstanceId = caseInstanceId;
this.dueDate = dueDate;
}
@Override
public Void execute(CommandContext commandContext) {
CaseInstanceEntityManager caseInstanceEntityManager = CommandContextUtil.getCaseInstanceEntityManager(commandContext);
CaseInstanceEntity caseInstanceEntity = caseInstanceEntityManager.findById(caseInstanceId);
if (caseInstanceEntity == null) {
throw new FlowableObjectNotFoundException("No case instance found for id = '" + caseInstanceId + "'.", CaseInstance.class);
}
caseInstanceEntityManager.updateCaseInstanceDueDate(caseInstanceEntity, dueDate);
return null;
}View on GitHub (pinned to d6d39ce1c6)
Solutions
- Ensure the caseInstanceId is a non-empty string before invoking setCaseInstanceDueDate
- Fix the source of the empty id (missing DTO field, unbound request parameter)
- Catch FlowableIllegalArgumentException at the API boundary and return a 400 with a clear message
Example fix
// before
cmmnRuntimeService.setCaseInstanceDueDate(caseInstanceId, dueDate); // caseInstanceId may be ""
// after
if (caseInstanceId == null || caseInstanceId.isEmpty()) {
throw new IllegalArgumentException("caseInstanceId must be provided");
}
cmmnRuntimeService.setCaseInstanceDueDate(caseInstanceId, dueDate); Defensive patterns
Strategy: validation
Validate before calling
if (caseInstanceId == null || caseInstanceId.trim().isEmpty()) {
throw new IllegalArgumentException("caseInstanceId must be a non-empty string");
} Type guard
boolean hasCaseInstanceId(String id) { return id != null && !id.trim().isEmpty(); } Try / catch
try {
cmmnRuntimeService.setCaseInstanceDueDate(caseInstanceId, dueDate);
} catch (FlowableIllegalArgumentException e) {
throw new BadRequestException("Invalid caseInstanceId: " + e.getMessage(), e);
} Prevention
- Validate request DTOs for non-blank ids before calling engine APIs
- Normalize empty strings to null early so null checks catch both
- Use bean validation (@NotBlank) on id fields
When it happens
Trigger: Calling CmmnRuntimeService.setCaseInstanceDueDate(null, dueDate) or with "" as the caseInstanceId.
Common situations: Uninitialized or empty string variables passed from request DTOs; upstream code that never set the case instance id; JSON deserialization producing empty strings instead of 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
- userId and groupId cannot both be null
- type is required when adding a new case instance identity li
- userId and groupId cannot both be null
- The case instance id is mandatory, but '
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/1324fe2b4226135c.
Report an issue: GitHub.