{"record":{"id":"e0b76cff2dc666ba","repo":"flowable/flowable-engine","slug":"variablename-is-null-e0b76c","errorCode":null,"errorMessage":"variableName is null","messagePattern":"variableName is null","errorType":"exception","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetTaskDataObjectCmd.java","lineNumber":66,"sourceCode":"    public GetTaskDataObjectCmd(String taskId, String variableName) {\n        this.taskId = taskId;\n        this.variableName = variableName;\n    }\n\n    public GetTaskDataObjectCmd(String taskId, String variableName, String locale, boolean withLocalizationFallback) {\n        this.taskId = taskId;\n        this.variableName = variableName;\n        this.locale = locale;\n        this.withLocalizationFallback = withLocalizationFallback;\n    }\n\n    @Override\n    public DataObject execute(CommandContext commandContext) {\n        if (taskId == null) {\n            throw new FlowableIllegalArgumentException(\"taskId is null\");\n        }\n        if (variableName == null) {\n            throw new FlowableIllegalArgumentException(\"variableName is null\");\n        }\n\n        ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration(commandContext);\n        TaskEntity task = processEngineConfiguration.getTaskServiceConfiguration().getTaskService().getTask(taskId);\n\n        if (task == null) {\n            throw new FlowableObjectNotFoundException(\"task \" + taskId + \" doesn't exist\", Task.class);\n        }\n\n        DataObject dataObject = null;\n        VariableInstance variableEntity = task.getVariableInstance(variableName, false);\n\n        String localizedName = null;\n        String localizedDescription = null;\n\n        if (variableEntity != null) {\n            ExecutionEntity executionEntity = CommandContextUtil.getExecutionEntityManager(commandContext).findById(variableEntity.getExecutionId());\n            while (!executionEntity.isScope()) {","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetTaskDataObjectCmd.java#L48-L84","documentation":"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.","triggerScenarios":"Calling taskService.getDataObject(...) or getDataObjects Local variants without specifying which variable to read, i.e. variableName is null.","commonSituations":"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.","solutions":["Pass the exact variable name string used when the variable was set on the task","Null-check/validate variableName in the calling layer before invoking the API","If the name comes from configuration, add a startup check that it is present"],"exampleFix":"// before\nDataObject d = taskService.getDataObject(taskId, variableName); // variableName null\n// after\nObjects.requireNonNull(variableName, \"variableName is required\");\nDataObject d = taskService.getDataObject(taskId, variableName);","handlingStrategy":"validation","validationCode":"if (variableName == null) {\n    throw new IllegalArgumentException(\"variableName is required\");\n}","typeGuard":"boolean hasVariableName(String name) {\n    return name != null && !name.trim().isEmpty();\n}","tryCatchPattern":"try {\n    DataObject d = taskService.getDataObject(taskId, variableName);\n} catch (FlowableIllegalArgumentException e) {\n    log.warn(\"variableName missing for task \" + taskId, e);\n}","preventionTips":["Use constants or an enum for variable names instead of ad-hoc strings","Check configuration that supplies variable names is loaded"],"tags":["java","flowable","null-argument","variables"],"backgroundTag":"null-argument","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}