flowable/flowable-engine · warning · FlowableIllegalArgumentException

variableNames is null

Error message

variableNames is null

What it means

Thrown as FlowableIllegalArgumentException by RemoveLocalVariablesCmd when the collection of variableNames to remove is null. Both a valid plan item instance id and a non-null variableNames collection are required.

Solutions

  1. Pass an initialized collection (use Collections.emptyList() to intentionally remove nothing)
  2. Guard the call: only invoke when the name list is non-null and non-empty
  3. Fix the upstream code that produced the null list

Example fix

// before
runtimeService.removeLocalVariables(instanceId, variableNames); // null list
// after
List<String> names = resolveNames();
if (names != null && !names.isEmpty()) {
    runtimeService.removeLocalVariables(instanceId, names);
}
Defensive patterns

Strategy: validation

Validate before calling

boolean canRemove = variableNames != null && !variableNames.isEmpty();

Try / catch

try { runtimeService.removeLocalVariables(id, variableNames); }
catch (FlowableIllegalArgumentException e) { /* null variableNames */ }

Prevention

When it happens

Trigger: Calling CmmnRuntimeService.removeLocalVariables(planItemInstanceId, null).

Common situations: Building the name list from a nullable source (query result, config) without a default; conditional code paths that skipped populating the collection.

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


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/dafef412d23d944a. Report an issue: GitHub.

Appendix: source

Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/RemoveLocalVariablesCmd.java:43

 * @author Tijs Rademakers
 */
public class RemoveLocalVariablesCmd implements Command<Void> {
    
    protected String planItemInstanceId;
    protected Collection<String> variableNames;
    
    public RemoveLocalVariablesCmd(String planItemInstanceId, Collection<String> variableNames) {
        this.planItemInstanceId = planItemInstanceId;
        this.variableNames = variableNames;
    }
    
    @Override
    public Void execute(CommandContext commandContext) {
        if (planItemInstanceId == null) {
            throw new FlowableIllegalArgumentException("planItemInstanceId is null");
        }
        if (variableNames == null) {
            throw new FlowableIllegalArgumentException("variableNames is null");
        }
     
        PlanItemInstanceEntity planItemInstanceEntity = CommandContextUtil.getPlanItemInstanceEntityManager(commandContext).findById(planItemInstanceId);
        if (planItemInstanceEntity == null) {
            throw new FlowableObjectNotFoundException("No plan item instance found for id " + planItemInstanceId, PlanItemInstanceEntity.class);
        }
        planItemInstanceEntity.removeVariables(variableNames);
        
        return null;
    }

}

View on GitHub (pinned to d6d39ce1c6)