flowable/flowable-engine · error · FlowableIllegalArgumentException

variableName is null

Error message

variableName is null

What it means

GetTaskDataObjectCmd requires both a taskId and a variableName to locate the requested task variable. When variableName is null, execute() throws FlowableIllegalArgumentException before any database access.

Solutions

  1. Pass the exact variable name string used when the variable was set on the task
  2. Null-check/validate variableName in the calling layer before invoking the API
  3. If the name comes from configuration, add a startup check that it is present

Example fix

// before
DataObject d = taskService.getDataObject(taskId, variableName); // variableName null
// after
Objects.requireNonNull(variableName, "variableName is required");
DataObject d = taskService.getDataObject(taskId, variableName);
Defensive patterns

Strategy: validation

Validate before calling

if (variableName == null) {
    throw new IllegalArgumentException("variableName is required");
}

Type guard

boolean hasVariableName(String name) {
    return name != null && !name.trim().isEmpty();
}

Try / catch

try {
    DataObject d = taskService.getDataObject(taskId, variableName);
} catch (FlowableIllegalArgumentException e) {
    log.warn("variableName missing for task " + taskId, e);
}

Prevention

When it happens

Trigger: Calling taskService.getDataObject(...) or getDataObjects Local variants without specifying which variable to read, i.e. variableName is null.

Common situations: Variable name read from configuration or a process variable that is unset; typos causing a null constant; generic data-layer code where the variable name parameter was dropped.

Related errors


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

Appendix: source

Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetTaskDataObjectCmd.java:66

    public GetTaskDataObjectCmd(String taskId, String variableName) {
        this.taskId = taskId;
        this.variableName = variableName;
    }

    public GetTaskDataObjectCmd(String taskId, String variableName, String locale, boolean withLocalizationFallback) {
        this.taskId = taskId;
        this.variableName = variableName;
        this.locale = locale;
        this.withLocalizationFallback = withLocalizationFallback;
    }

    @Override
    public DataObject execute(CommandContext commandContext) {
        if (taskId == null) {
            throw new FlowableIllegalArgumentException("taskId is null");
        }
        if (variableName == null) {
            throw new FlowableIllegalArgumentException("variableName is null");
        }

        ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration(commandContext);
        TaskEntity task = processEngineConfiguration.getTaskServiceConfiguration().getTaskService().getTask(taskId);

        if (task == null) {
            throw new FlowableObjectNotFoundException("task " + taskId + " doesn't exist", Task.class);
        }

        DataObject dataObject = null;
        VariableInstance variableEntity = task.getVariableInstance(variableName, false);

        String localizedName = null;
        String localizedDescription = null;

        if (variableEntity != null) {
            ExecutionEntity executionEntity = CommandContextUtil.getExecutionEntityManager(commandContext).findById(variableEntity.getExecutionId());
            while (!executionEntity.isScope()) {

View on GitHub (pinned to d6d39ce1c6)