flowable/flowable-engine · error · FlowableIllegalArgumentException
caseInstanceId is null
Error message
caseInstanceId is null
What it means
GetCaseVariableInstancesCmd validates that a caseInstanceId was supplied before it looks up the case instance. A null id cannot identify any case, so Flowable throws FlowableIllegalArgumentException immediately. This is a caller contract violation, not an engine-state problem.
Source
Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/GetCaseVariableInstancesCmd.java:42
import org.flowable.common.engine.impl.interceptor.CommandContext;
import org.flowable.variable.api.persistence.entity.VariableInstance;
public class GetCaseVariableInstancesCmd implements Command<Map<String, VariableInstance>>, Serializable {
private static final long serialVersionUID = 1L;
protected String caseInstanceId;
public GetCaseVariableInstancesCmd(String caseInstanceId) {
this.caseInstanceId = caseInstanceId;
}
@Override
public Map<String, VariableInstance> execute(CommandContext commandContext) {
// Verify existence of execution
if (caseInstanceId == null) {
throw new FlowableIllegalArgumentException("caseInstanceId is null");
}
CaseInstanceEntity caseInstance = CommandContextUtil.getCaseInstanceEntityManager(commandContext).findById(caseInstanceId);
if (caseInstance == null) {
throw new FlowableObjectNotFoundException("case instance " + caseInstanceId + " doesn't exist", CaseInstance.class);
}
return caseInstance.getVariableInstances();
}
}
View on GitHub (pinned to d6d39ce1c6)
Solutions
- Pass a valid non-null caseInstanceId to the API
- Validate the id (non-null, non-empty) at the API boundary before calling the engine
- Trace the id's origin and fix why it is null
Example fix
// before
Map<String, VariableInstance> vars = caseService.getVariableInstances(caseInstanceId);
// after
if (caseInstanceId == null) {
throw new IllegalArgumentException("caseInstanceId must be provided");
}
Map<String, VariableInstance> vars = caseService.getVariableInstances(caseInstanceId); Defensive patterns
Strategy: validation
Validate before calling
Objects.requireNonNull(caseInstanceId, "caseInstanceId is required");
Type guard
boolean hasId = caseInstanceId != null && !caseInstanceId.isEmpty();
Try / catch
try { return caseService.getVariables(caseInstanceId); } catch (FlowableIllegalArgumentException e) { log.error("Null caseInstanceId"); throw e; } Prevention
- Reject missing id path/query parameters at the REST layer
- Avoid passing possibly-null query results onward
- Use @NotNull-style bean validation on DTOs
When it happens
Trigger: Calling caseService.getVariables(caseInstanceId) / getVariableInstances with a null caseInstanceId, typically when the id comes from an unset field, failed lookup, or unvalidated request payload.
Common situations: REST endpoint where the id path/query parameter was absent; bean property never populated; result of an earlier query that returned null and was passed on unguarded.
Related errors
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/d2de7eb91048cba7.
Report an issue: GitHub.