{"record":{"id":"c2f5d1942e31e271","repo":"kestra-io/kestra","slug":"could-not-perform-greater-than-or-equals-compariso","errorCode":null,"errorMessage":"Could not perform greater than or equals comparison","messagePattern":"Could not perform greater than or equals comparison","errorType":"exception","errorClass":"PebbleException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/io/kestra/core/runners/pebble/expression/GreaterThanEqualsExpression.java","lineNumber":24,"sourceCode":"import io.pebbletemplates.pebble.template.PebbleTemplateImpl;\nimport io.pebbletemplates.pebble.utils.OperatorUtils;\n\npublic class GreaterThanEqualsExpression extends BinaryExpression<Boolean> {\n    @Override\n    public Boolean evaluate(PebbleTemplateImpl self, EvaluationContextImpl context) {\n        Object left = this.getLeftExpression().evaluate(self, context);\n        Object right = this.getRightExpression().evaluate(self, context);\n\n        // add support for string comparison\n        if (left instanceof String sLeft && right instanceof String sRight) {\n            return sLeft.compareTo(sRight) >= 0;\n        }\n\n        // default implementation from io.pebbletemplates.pebble.node.expression.GreaterThanExpression\n        try {\n            return OperatorUtils.gte(left, right);\n        } catch (Exception ex) {\n            throw new PebbleException(\n                ex, \"Could not perform greater than or equals comparison\", this.getLineNumber(), self\n                    .getName()\n            );\n        }\n    }\n}\n","sourceCodeStart":6,"sourceCodeEnd":31,"githubUrl":"https://github.com/kestra-io/kestra/blob/823fada9274c4f9c251ea0a516460a4f7d958032/core/src/main/java/io/kestra/core/runners/pebble/expression/GreaterThanEqualsExpression.java#L6-L31","documentation":"Thrown by the custom GreaterThanEqualsExpression Pebble node when the '>=' comparison cannot be performed. The expression first tries native string comparison (if both sides are strings), then delegates to Pebble's OperatorUtils.gte for numeric comparisons. If gte throws — typically because the operands are incomparable types — the exception is wrapped and rethrown with this message.","triggerScenarios":"Using the '>=' operator in a Pebble template between operands that are neither both strings nor mutually comparable numbers: '{{ somelist >= 5 }}', '{{ null >= 3 }}', or '{{ mymap >= \"abc\" }}'. Also when one side is null and the other is a non-string.","commonSituations":"Comparing a variable that resolves to null, a list, or a map against a number or string. Flow conditions using '>=' on outputs whose type is not guaranteed (e.g., comparing a task output that might be a JSON object). Version upgrades where an output type changed from scalar to complex.","solutions":["Ensure both operands of '>=' are either both strings or both numbers.","Guard against null with a default: '{{ (vars.value ?? 0) >= 5 }}'.","Add a type-check or cast before comparison to confirm the operand is numeric."],"exampleFix":"{# before #}\n{% if outputs.task.value >= 10 %}\n\n{# after — guard null + ensure numeric #}\n{% if (outputs.task.value ?? 0) >= 10 %}","handlingStrategy":"validation","validationCode":"{# Default both sides to a numeric value before using >= #}\n{% set left = (vars.metric ?? 0) %}\n{% set right = (vars.threshold ?? 0) %}\n{% if left >= right %}...{% endif %}","typeGuard":"{# Pebble does not have a native 'is number' test, but you can guard with a default #}\n{% set safe_val = vars.value ?? 0 %}\n{% if safe_val is not null and safe_val is iterable %}\n  {# value is a collection — do not compare with >= #}\n{% else %}\n  {{ safe_val >= 10 }}\n{% endif %}","tryCatchPattern":null,"preventionTips":["Always default comparison operands with ?? to avoid null-vs-number mismatches.","Ensure task outputs used in comparisons are typed as numbers in the task definition.","Add flow validation tests that exercise comparison expressions with edge-case inputs."],"tags":["pebble","comparison","greater-than-equals","type-mismatch"],"backgroundTag":null,"analyzedSha":"823fada9274c4f9c251ea0a516460a4f7d958032","analyzedAt":"2026-08-14T06:15:17.947Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}