flowable/flowable-engine · error · FlowableIllegalArgumentException
variableNames is null
Error message
variableNames is null
What it means
RemoveVariablesCmd requires a non-null collection of variable names. When variableNames is null it throws FlowableIllegalArgumentException because there is nothing to remove and the command cannot proceed meaningfully.
Solutions
- Pass an empty collection or skip the call when there are no names, instead of null
- Normalize collection-returning helpers to return Collections.emptyList()
- Validate the input collection before invoking
Example fix
// before cmmnRuntimeService.removeVariables(caseInstanceId, names); // names may be null // after cmmnRuntimeService.removeVariables(caseInstanceId, names == null ? Collections.emptyList() : names);
Defensive patterns
Strategy: validation
Validate before calling
List<String> safeNames = names == null ? Collections.emptyList() : names;
Try / catch
try { cmmnRuntimeService.removeVariables(id, names); } catch (FlowableIllegalArgumentException e) { log.error("Invalid variableNames: {}", e.getMessage()); } Prevention
- Normalize collection getters to return empty collections
- Avoid passing deserialized (possibly null) collections straight to the engine
- Skip the engine call entirely when the name list is empty
When it happens
Trigger: Calling removeVariables(caseInstanceId, null); commonly the names collection came from a null-valued field, an absent request body entry, or a method returning null instead of an empty collection.
Common situations: Jackson deserializing missing JSON arrays to null; helper methods returning null on no-match instead of Collections.emptyList(); refactors changing a single-name API to a collection API.
Related errors
- caseInstanceId is null
- caseInstanceId is null
- caseInstanceId is null
- caseInstanceId is null
- caseInstanceId is null
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/15d6b651c19fa1ca.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/RemoveVariablesCmd.java:43
* @author Tijs Rademakers
*/
public class RemoveVariablesCmd implements Command<Void> {
protected String caseInstanceId;
protected Collection<String> variableNames;
public RemoveVariablesCmd(String caseInstanceId, Collection<String> variableNames) {
this.caseInstanceId = caseInstanceId;
this.variableNames = variableNames;
}
@Override
public Void execute(CommandContext commandContext) {
if (caseInstanceId == null) {
throw new FlowableIllegalArgumentException("caseInstanceId is null");
}
if (variableNames == null) {
throw new FlowableIllegalArgumentException("variableNames is null");
}
CaseInstanceEntity caseInstanceEntity = CommandContextUtil.getCaseInstanceEntityManager(commandContext).findById(caseInstanceId);
if (caseInstanceEntity == null) {
throw new FlowableObjectNotFoundException("No case instance found for id " + caseInstanceId, CaseInstanceEntity.class);
}
caseInstanceEntity.removeVariables(variableNames);
return null;
}
}
View on GitHub (pinned to d6d39ce1c6)