{"record":{"id":"9309f967f68e7e15","repo":"flowable/flowable-engine","slug":"name-is-null-9309f9","errorCode":null,"errorMessage":"name is null","messagePattern":"name is null","errorType":"validation","errorClass":"ActivitiIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/AbstractVariableQueryImpl.java","lineNumber":172,"sourceCode":"    public T variableValueLikeIgnoreCase(String name, String value) {\n        return variableValueLikeIgnoreCase(name, value, true);\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    public T variableValueLike(String name, String value, boolean localScope) {\n        addVariable(name, value, QueryOperator.LIKE, localScope);\n        return (T) this;\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    public T variableValueLikeIgnoreCase(String name, String value, boolean localScope) {\n        addVariable(name, value, QueryOperator.LIKE_IGNORE_CASE, localScope);\n        return (T) this;\n    }\n\n    private void addVariable(String name, Object value, QueryOperator operator, boolean localScope) {\n        if (name == null) {\n            throw new ActivitiIllegalArgumentException(\"name is null\");\n        }\n        if (value == null || isBoolean(value)) {\n            // Null-values and booleans can only be used in EQUALS and NOT_EQUALS\n            switch (operator) {\n                case GREATER_THAN:\n                    throw new ActivitiIllegalArgumentException(\"Booleans and null cannot be used in 'greater than' condition\");\n                case LESS_THAN:\n                    throw new ActivitiIllegalArgumentException(\"Booleans and null cannot be used in 'less than' condition\");\n                case GREATER_THAN_OR_EQUAL:\n                    throw new ActivitiIllegalArgumentException(\"Booleans and null cannot be used in 'greater than or equal' condition\");\n                case LESS_THAN_OR_EQUAL:\n                    throw new ActivitiIllegalArgumentException(\"Booleans and null cannot be used in 'less than or equal' condition\");\n            }\n\n            if (operator == QueryOperator.EQUALS_IGNORE_CASE && !(value instanceof String)) {\n                throw new ActivitiIllegalArgumentException(\"Only string values can be used with 'equals ignore case' condition\");\n            }\n","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/AbstractVariableQueryImpl.java#L154-L190","documentation":"ActivitiIllegalArgumentException thrown by the private addVariable method of AbstractVariableQueryImpl when the variable name is null. Every variable query condition added via variableValueEquals/Like/IgnoreCase-style methods funnels through addVariable, which requires a non-null name to build a QueryVariableValue. Fail-fast validation before the query is executed.","triggerScenarios":"Calling any variable query method such as taskVariableValueEquals(null, value), variableValueLike(null, value), variableValueGreaterThan(null, v), etc., with a null variable name.","commonSituations":"The variable name comes from a constant map, properties file key, or external configuration that is missing, so getName()/config lookup returns null and is passed into the query builder.","solutions":["Ensure the variable name constant/key exists and is non-null before building the query.","Null-check the name variable and throw a descriptive application-level error naming the missing configuration key.","Verify refactoring did not break a constant reference (e.g. renamed field constant now resolving to null)."],"exampleFix":"// before\nString varName = config.get(\"priorityVar\");\nquery.taskVariableValueEquals(varName, 5);\n// after\nString varName = config.get(\"priorityVar\");\nif (varName == null) {\n    throw new IllegalStateException(\"config key priorityVar is required\");\n}\nquery.taskVariableValueEquals(varName, 5);","handlingStrategy":"validation","validationCode":"Objects.requireNonNull(varName, \"Variable name must not be null\");\nquery.taskVariableValueEquals(varName, value);","typeGuard":"boolean isValidVarName(String n) { return n != null && !n.trim().isEmpty(); }","tryCatchPattern":"try {\n    builder.addVariableCondition(name, value);\n} catch (ActivitiIllegalArgumentException e) {\n    throw new IllegalStateException(\"Bad query condition: \" + e.getMessage(), e);\n}","preventionTips":["Source variable names from compile-time constants, not nullable lookups","Fail fast on missing configuration keys that supply variable names","Add unit tests covering query builders with missing config"],"tags":["activiti","query","null-check","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-18T11:17:12.947Z"}