flowable/flowable-engine · error · FlowableIllegalArgumentException
variableName is null
Error message
variableName is null
What it means
Flowable's GetCaseVariableInstanceCmd validates its inputs before querying the case instance entity manager. When the variableName passed to the command is null, it aborts immediately with FlowableIllegalArgumentException. This indicates a caller-side bug: the API was invoked without a variable name, which can never resolve to a variable instance.
Source
Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/GetCaseVariableInstanceCmd.java:45
public class GetCaseVariableInstanceCmd implements Command<VariableInstance>, Serializable {
private static final long serialVersionUID = 1L;
protected String caseInstanceId;
protected String variableName;
public GetCaseVariableInstanceCmd(String caseInstanceId, String variableName) {
this.caseInstanceId = caseInstanceId;
this.variableName = variableName;
}
@Override
public VariableInstance execute(CommandContext commandContext) {
if (caseInstanceId == null) {
throw new FlowableIllegalArgumentException("caseInstanceId is null");
}
if (variableName == null) {
throw new FlowableIllegalArgumentException("variableName is null");
}
CmmnEngineConfiguration cmmnEngineConfiguration = CommandContextUtil.getCmmnEngineConfiguration(commandContext);
CaseInstanceEntity caseInstance = cmmnEngineConfiguration.getCaseInstanceEntityManager().findById(caseInstanceId);
if (caseInstance == null) {
throw new FlowableObjectNotFoundException("case instance " + caseInstanceId + " doesn't exist", CaseInstance.class);
}
return caseInstance.getVariableInstance(variableName, false);
}
}
View on GitHub (pinned to d6d39ce1c6)
Solutions
- Pass a non-null variableName string to the getCaseVariableInstance call
- Check where the variable name originates (Map key, request parameter, config) and fix the null source
- Add a null/empty check on the variable name before invoking the API
Example fix
// before
caseService.getVariableInstance(caseInstanceId, variableName);
// after
if (variableName != null && !variableName.isEmpty()) {
caseService.getVariableInstance(caseInstanceId, variableName);
} Defensive patterns
Strategy: validation
Validate before calling
if (variableName == null || variableName.isEmpty()) { throw new IllegalArgumentException("variableName is required"); } Type guard
boolean hasVariableName = (name instanceof String) && !((String) name).isEmpty();
Try / catch
try { caseService.getVariableInstance(caseInstanceId, variableName); } catch (FlowableIllegalArgumentException e) { log.error("Bad argument: {}", e.getMessage()); throw e; } Prevention
- Never build variable names from nullable values without a guard
- Prefer constants or enums for well-known variable names
- Validate API inputs at the boundary layer
When it happens
Trigger: Calling RuntimeService/CaseService.getCaseVariableInstance (or TaskService equivalent) with a null variable name argument, e.g. cmmnRuntimeService.getVariableInstance(caseInstanceId, null).
Common situations: Variable name pulled from a Map key, config property, or database value that is null; refactored code where a constant was replaced by a nullable parameter; dynamic variable lookups where the name is built at runtime.
Related errors
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/4649b8e718ef6438.
Report an issue: GitHub.