{"record":{"id":"1e80f672a6d5d297","repo":"flowable/flowable-engine","slug":"variablename-is-null-1e80f6","errorCode":null,"errorMessage":"variableName is null","messagePattern":"variableName is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetExecutionVariableCmd.java","lineNumber":50,"sourceCode":"\n    private static final long serialVersionUID = 1L;\n    protected String executionId;\n    protected String variableName;\n    protected boolean isLocal;\n\n    public GetExecutionVariableCmd(String executionId, String variableName, boolean isLocal) {\n        this.executionId = executionId;\n        this.variableName = variableName;\n        this.isLocal = isLocal;\n    }\n\n    @Override\n    public Object execute(CommandContext commandContext) {\n        if (executionId == null) {\n            throw new FlowableIllegalArgumentException(\"executionId is null\");\n        }\n        if (variableName == null) {\n            throw new FlowableIllegalArgumentException(\"variableName is null\");\n        }\n\n        ExecutionEntity execution = CommandContextUtil.getExecutionEntityManager(commandContext).findById(executionId);\n\n        if (execution == null) {\n            throw new FlowableObjectNotFoundException(\"execution \" + executionId + \" doesn't exist\", Execution.class);\n        }\n\n        if (Flowable5Util.isFlowable5ProcessDefinitionId(commandContext, execution.getProcessDefinitionId())) {\n            Flowable5CompatibilityHandler compatibilityHandler = Flowable5Util.getFlowable5CompatibilityHandler();\n            return compatibilityHandler.getExecutionVariable(executionId, variableName, isLocal);\n        }\n\n        Object value;\n\n        if (isLocal) {\n            value = execution.getVariableLocal(variableName, false);\n        } else {","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetExecutionVariableCmd.java#L32-L68","documentation":"GetExecutionVariableCmd.execute() validates that variableName is non-null with FlowableIllegalArgumentException. Reading an execution variable requires naming it; a null name is rejected before any database access.","triggerScenarios":"Calling RuntimeService.getVariable(executionId, null) or getVariableLocal(executionId, null), usually when the variable name comes from unvalidated configuration or request data.","commonSituations":"Variable name held in a config property that is unset; dynamic key resolution returning null; copy/paste where the key literal was lost; mapping code dropping empty keys.","solutions":["Check the variable name for null/blank before the call.","Validate variable-name input at the service/REST layer and reject blank values.","Ensure configuration supplying variable names is complete (see Flowable variable-name config keys).","Log and fail fast with a clear message naming the missing configuration item."],"exampleFix":"// before\nObject v = runtimeService.getVariable(executionId, varName);\n// after\nif (varName == null || varName.isBlank()) {\n    throw new IllegalArgumentException(\"variableName is required\");\n}\nObject v = runtimeService.getVariable(executionId, varName);","handlingStrategy":"validation","validationCode":"if (variableName == null || variableName.isBlank()) {\n    throw new IllegalArgumentException(\"variableName is required\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    runtimeService.getVariable(executionId, variableName);\n} catch (FlowableIllegalArgumentException e) {\n    // null/blank variable name: check config supplying the name\n}","preventionTips":["Validate variable-name config keys at startup","Reject blank names in request validation","Keep variable names as constants, not ad-hoc strings","Log the configuration source when a name is missing"],"tags":["flowable","null-argument","variable","validation"],"backgroundTag":"null-argument","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T16:30:33.424Z"}