{"record":{"id":"af4313318f21515d","repo":"flowable/flowable-engine","slug":"variable-name-passed-is-null","errorCode":null,"errorMessage":"Variable name passed is null","messagePattern":"Variable name passed is null","errorType":"exception","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/el/function/AbstractFlowableVariableExpressionFunction.java","lineNumber":104,"sourceCode":"    public Collection<String> localNames() {\n        return functionNamesOptions;\n    }\n\n    @Override\n    public Method functionMethod() {\n        if (method != null) {\n            return method;\n        }\n\n        method = findMethod(functionName);\n        return method;\n    }\n\n    // Helper methods\n    \n    protected static Object getVariableValue(VariableContainer variableContainer, String variableName) {\n        if (variableName == null) {\n            throw new FlowableIllegalArgumentException(\"Variable name passed is null\");\n        }\n        return variableContainer.getVariable(variableName);\n    }\n    \n    protected static boolean valuesAreNumbers(Object variableValue, Object actualValue) {\n        return actualValue instanceof Number && variableValue instanceof Number;\n    }\n\n    @Override\n    public Collection<String> getFunctionNames() {\n        Collection<String> functionNames = new LinkedHashSet<>();\n        for (String functionPrefix : prefixes()) {\n            for (String functionNameOption : localNames()) {\n                functionNames.add(functionPrefix + \":\" + functionNameOption);\n            }\n        }\n\n        return functionNames;","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/el/function/AbstractFlowableVariableExpressionFunction.java#L86-L122","documentation":"Helper getVariableValue in AbstractFlowableVariableExpressionFunction validates that the variable name argument passed to an EL function such as vars:get / vars:exists is non-null before reading it from the VariableContainer. A null name cannot identify any variable, so a FlowableIllegalArgumentException is thrown.","triggerScenarios":"Evaluating an expression like ${vars:get(null)} or a function call where the variableName argument resolves to null (e.g. from another expression or variable that is null).","commonSituations":"Expression built dynamically where a name parameter variable is null at runtime; copy-paste/refactoring leaving a null literal as the function argument; chained expressions where an earlier lookup returned null and its result is used as the variable name.","solutions":["Pass a literal or non-null computed variable name to the EL function.","Guard the argument in the expression, e.g. ${myName != null ? vars:get(myName) : null} or use vars:isEmpty with a literal name.","Fix the upstream logic that produced a null name.","In Java code calling the function helper directly, assert the name is non-null before invoking."],"exampleFix":"// before (expression)\n${vars:get(someNameThatMayBeNull)}\n\n// after\n${someNameThatMayBeNull != null ? vars:get(someNameThatMayBeNull) : null}","handlingStrategy":"validation","validationCode":"Object name = resolveName(); // EL function argument\nif (name == null) {\n    return null; // or throw a domain-specific error before calling vars:get\n}","typeGuard":"boolean isNonEmptyString(Object o) { return o instanceof String && !((String) o).isEmpty(); }","tryCatchPattern":"try {\n    Object v = expressionManager.evaluateExpression(expr, execution);\n} catch (FlowableIllegalArgumentException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"null\")) {\n        log.warn(\"EL function called with null variable name\");\n    }\n    throw e;\n}","preventionTips":["Use literal variable names in vars:get/vars:exists calls wherever possible.","Null-check dynamic name sources before using them as function arguments.","Avoid chaining lookups where one result feeds another as a variable name."],"tags":["el","function","null-check","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"}