{"record":{"id":"4c473541635de58d","repo":"flowable/flowable-engine","slug":"booleans-and-null-cannot-be-used-in-greater-than-4c4735","errorCode":null,"errorMessage":"Booleans and null cannot be used in 'greater than or equal' condition","messagePattern":"Booleans and null cannot be used in 'greater than or equal' condition","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-variable-service/src/main/java/org/flowable/variable/service/impl/AbstractVariableQueryImpl.java","lineNumber":311,"sourceCode":"    }\n\n    protected void addVariable(String name, Object value, QueryOperator operator, boolean localScope) {\n        this.addVariable(name, value, operator, null, localScope);\n    }\n\n    protected void addVariable(String name, Object value, QueryOperator operator, String scopeType, boolean localScope) {\n        if (name == null) {\n            throw new FlowableIllegalArgumentException(\"name is null\");\n        }\n        if (value == null || isBoolean(value)) {\n            // Null-values and booleans can only be used in EQUALS, NOT_EQUALS, EXISTS and NOT_EXISTS\n            switch (operator) {\n                case GREATER_THAN:\n                    throw new FlowableIllegalArgumentException(\"Booleans and null cannot be used in 'greater than' condition\");\n                case LESS_THAN:\n                    throw new FlowableIllegalArgumentException(\"Booleans and null cannot be used in 'less than' condition\");\n                case GREATER_THAN_OR_EQUAL:\n                    throw new FlowableIllegalArgumentException(\"Booleans and null cannot be used in 'greater than or equal' condition\");\n                case LESS_THAN_OR_EQUAL:\n                    throw new FlowableIllegalArgumentException(\"Booleans and null cannot be used in 'less than or equal' condition\");\n                default:\n                    break;\n            }\n\n            if (operator == QueryOperator.EQUALS_IGNORE_CASE && !(value instanceof String)) {\n                throw new FlowableIllegalArgumentException(\"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 FlowableIllegalArgumentException(\"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 FlowableIllegalArgumentException(\"Only string values can be used with 'like' condition\");\n            }\n        }","sourceCodeStart":293,"sourceCodeEnd":329,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-variable-service/src/main/java/org/flowable/variable/service/impl/AbstractVariableQueryImpl.java#L293-L329","documentation":"GREATER_THAN_OR_EQUAL comparisons are invalid with null or Boolean values in Flowable variable queries; the ordering of such values is undefined. AbstractVariableQueryImpl.addVariable detects this combination and throws FlowableIllegalArgumentException at query build time. No database interaction occurs.","triggerScenarios":"Calling variableValueGreaterThanOrEqual (or scoped variants) with value=null or a Boolean value, e.g. taskVariableValueGreaterThanOrEqual(\"count\", null).","commonSituations":"Nullable numeric values boxed into Object and passed through; boolean thresholds in feature-flag queries; copy-pasted builder code where the value type changed from Integer to Boolean/null.","solutions":["Ensure the value is a non-null comparable type (Integer, Long, Date, String) before calling","Use EQUALS for booleans, EXISTS for null checks","Coerce null to a sensible default or omit the clause conditionally","Filter results in memory when the value may be null/boolean"],"exampleFix":"// before\nif (minCount != null) q.variableValueGreaterThanOrEqual(\"count\", minCount);\n// after (still required minCount non-null numeric; for booleans use equals)\nq.variableValueGreaterThanOrEqual(\"count\", minCount == null ? 0 : minCount);","handlingStrategy":"validation","validationCode":"if (value == null || value instanceof Boolean) {\n    throw new IllegalArgumentException(\"GreaterThanOrEqual requires a non-null non-boolean value\");\n}\nquery.variableValueGreaterThanOrEqual(name, value);","typeGuard":"static boolean isOrderable(Object v) {\n    return v instanceof Comparable && !(v instanceof Boolean);\n}","tryCatchPattern":"try {\n    query.variableValueGreaterThanOrEqual(name, value);\n} catch (org.flowable.common.engine.api.FlowableIllegalArgumentException e) {\n    // handle: use equals or skip clause\n}","preventionTips":["Default null bounds to sensible numeric/date values before querying","Use equals for boolean thresholds","Type your query helper parameters narrowly (Integer/Date/String)","Add assertions in shared query-builder utilities"],"tags":["flowable","validation","query","null"],"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"}