{"record":{"id":"14ea385f6971523a","repo":"flowable/flowable-engine","slug":"booleans-and-null-cannot-be-used-in-greater-than-14ea38","errorCode":null,"errorMessage":"Booleans and null cannot be used in 'greater than' condition","messagePattern":"Booleans and null cannot be used in 'greater than' condition","errorType":"validation","errorClass":"ActivitiIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/AbstractVariableQueryImpl.java","lineNumber":178,"sourceCode":"        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\n            if (operator == QueryOperator.NOT_EQUALS_IGNORE_CASE && !(value instanceof String)) {\n                throw new ActivitiIllegalArgumentException(\"Only string values can be used with 'not equals ignore case' condition\");\n            }\n\n            if ((operator == QueryOperator.LIKE || operator == QueryOperator.LIKE_IGNORE_CASE) && !(value instanceof String)) {\n                throw new ActivitiIllegalArgumentException(\"Only string values can be used with 'like' condition\");","sourceCodeStart":160,"sourceCodeEnd":196,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/AbstractVariableQueryImpl.java#L160-L196","documentation":"ActivitiIllegalArgumentException thrown by addVariable when a null or Boolean value is combined with the GREATER_THAN operator. Null values and booleans only support EQUALS and NOT_EQUALS semantics because ordering comparisons on them are undefined in the variable-query model. The check runs at query-build time, before execution.","triggerScenarios":"Calling variableValueGreaterThan(name, null), variableValueGreaterThan(name, someBoolean), or adding a GREATER_THAN condition whose value evaluates to Boolean/null, e.g. dynamic query builders branching on user-supplied filter values.","commonSituations":"Dynamic filter UIs or generic query wrappers map a null or boolean input to a 'greater than' predicate, or a type change (int flag became Boolean) silently routes boolean values into ordering operators.","solutions":["Restrict ordering conditions to numeric, date, or string values; handle booleans with EQUALS.","Null-check the value and skip the condition when it is null.","If the field became boolean, replace variableValueGreaterThan with variableValueEquals(name, true/false)."],"exampleFix":"// before\nquery.taskVariableGreaterThan(\"active\", isActive);\n// after\nquery.taskVariableValueEquals(\"active\", isActive);","handlingStrategy":"type-guard","validationCode":"if (value != null && !(value instanceof Boolean)) {\n    query.taskVariableGreaterThan(name, value);\n} else if (value instanceof Boolean) {\n    query.taskVariableValueEquals(name, value);\n}","typeGuard":"boolean isOrderable(Object v) { return v != null && !(v instanceof Boolean); }","tryCatchPattern":"try {\n    query.taskVariableGreaterThan(name, value);\n} catch (ActivitiIllegalArgumentException e) {\n    log.warn(\"Cannot order-compare value {}: {}\", value, e.getMessage());\n}","preventionTips":["Dispatch boolean values to EQUALS conditions in dynamic query builders","Never wire unset (null) inputs into range operators","Type-check filter values before selecting a query operator"],"tags":["activiti","query","boolean","operator"],"backgroundTag":"invalid-argument-value","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"}