flowable/flowable-engine · error · FlowableIllegalArgumentException

variableName is null

Error message

variableName is null

What it means

Argument validation in CmmnTaskServiceImpl.setVariable(taskId, variableName, value): a null variableName is rejected before SetTaskVariablesCmd runs. Note taskId itself is validated later inside the command, but the variable name must be non-null here.

Source

Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/CmmnTaskServiceImpl.java:332

    @Override
    public <T> T getVariableLocal(String taskId, String variableName, Class<T> variableClass) {
        return variableClass.cast(getVariableLocal(taskId, variableName));
    }

    @Override
    public List<VariableInstance> getVariableInstancesLocalByTaskIds(Set<String> taskIds) {
        return commandExecutor.execute(new GetTasksLocalVariablesCmd(taskIds));
    }

    @Override
    public boolean hasVariableLocal(String taskId, String variableName) {
        return commandExecutor.execute(new HasTaskVariableCmd(taskId, variableName, true));
    }

    @Override
    public void setVariable(String taskId, String variableName, Object value) {
        if (variableName == null) {
            throw new FlowableIllegalArgumentException("variableName is null");
        }
        Map<String, Object> variables = new HashMap<>();
        variables.put(variableName, value);
        commandExecutor.execute(new SetTaskVariablesCmd(taskId, variables, false));
    }

    @Override
    public void setVariableLocal(String taskId, String variableName, Object value) {
        if (variableName == null) {
            throw new FlowableIllegalArgumentException("variableName is null");
        }
        Map<String, Object> variables = new HashMap<>();
        variables.put(variableName, value);
        commandExecutor.execute(new SetTaskVariablesCmd(taskId, variables, true));
    }

    @Override
    public void setVariables(String taskId, Map<String, ? extends Object> variables) {

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Validate variableName is a non-empty string before calling setVariable
  2. Fix the data source producing null names (payload validation, map iteration)
  3. Use Objects.requireNonNull(variableName) early with a clear message at the caller

Example fix

// before
cmmnTaskService.setVariable(taskId, request.getVarName(), value);
// after
String name = request.getVarName();
if (name != null && !name.isEmpty()) {
    cmmnTaskService.setVariable(taskId, name, value);
}
Defensive patterns

Strategy: validation

Validate before calling

if (variableName == null || variableName.isEmpty()) throw new IllegalArgumentException("variableName required");

Try / catch

try { taskService.setVariable(taskId, name, value); } catch (FlowableIllegalArgumentException e) { /* null name */ }

Prevention

When it happens

Trigger: Calling cmmnTaskService.setVariable(taskId, null, value) — typically when the variable name comes from a map key, header, or user input that was null.

Common situations: Iterating a Map with null keys or building variables from request payloads with missing names; a variable-name constant that was renamed/removed; dynamic variable names computed from case data.

Related errors


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