{"record":{"id":"e8bc0fc4bf213874","repo":"quarkusio/quarkus","slug":"not-a-legal-operator","errorCode":null,"errorMessage":"Not a legal operator: ","messagePattern":"Not a legal operator: ","errorType":"exception","errorClass":"TemplateException","httpStatus":null,"severity":"error","filePath":"independent-projects/qute/core/src/main/java/io/quarkus/qute/WhenSectionHelper.java","lineNumber":254,"sourceCode":"        }\n\n        boolean evaluate(Object value, List<?> params) {\n            switch (this) {\n                case EQ:\n                    return Objects.equals(value, params.get(0));\n                case NE:\n                    return !Objects.equals(value, params.get(0));\n                case GE:\n                case GT:\n                case LE:\n                case LT:\n                    return compare(value, params.get(0));\n                case IN:\n                    return params.contains(value);\n                case NOT_IN:\n                    return !params.contains(value);\n                default:\n                    throw new TemplateException(\"Not a legal operator: \" + this);\n            }\n        }\n\n        @SuppressWarnings({ \"rawtypes\", \"unchecked\" })\n        boolean compare(Object op1, Object op2) {\n            if (op1 == null || op2 == null) {\n                throw new TemplateException(\"Unable to compare null operands [op1=\" + op1 + \", op2=\" + op2 + \"]\");\n            }\n            Comparable c1;\n            Comparable c2;\n            if (op1 instanceof Comparable && op1.getClass().equals(op2.getClass())) {\n                c1 = (Comparable) op1;\n                c2 = (Comparable) op2;\n            } else {\n                c1 = Operator.getDecimal(op1);\n                c2 = Operator.getDecimal(op2);\n            }\n            int result = c1.compareTo(c2);","sourceCodeStart":236,"sourceCodeEnd":272,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/qute/core/src/main/java/io/quarkus/qute/WhenSectionHelper.java#L236-L272","documentation":"Qute's {when}/switch-style sections support a fixed set of binary operators (==, !=, <, >, <=, >=, in, not in). When the parser produced an operator enum value that has no evaluation branch, WhenSectionHelper.Operator.evaluate() throws TemplateException. It indicates an unhandled/unsupported operator reached the evaluation stage.","triggerScenarios":"Evaluating a {when} / {if} condition whose operator is a Qute operator enum value with no case in the evaluate() switch (e.g. a new/internal operator used without an evaluation branch, or programmatic template building inserting an unexpected Operator).","commonSituations":"Programmatic template/section construction using internal APIs; running a template built on a newer Qute version against an older runtime where the operator enum gained new members; typos in custom section code reusing Operator enums.","solutions":["Upgrade qute-core (io.quarkus.qute) so runtime and template compiler versions match — mismatched versions are the most common cause.","Inspect the template expression that produced the operator and replace it with a supported one (==, !=, <, >, <=, >=, in, not in).","If building expressions programmatically, only pass operators from WhenSectionHelper.Operator's supported set.","If you maintain a fork and added an operator, add a corresponding case in evaluate()."],"exampleFix":"// before (unsupported/unknown operator)\n{#when myValue is 'x'}...{/} // invalid operator syntax\n// after\n{#when myValue}\n  {#is eq 'x'}...{/}\n{/}","handlingStrategy":"validation","validationCode":"Set<String> supported = Set.of(\"eq\",\"ne\",\"lt\",\"le\",\"gt\",\"ge\",\"in\",\"not in\",\"is\");\nif (!supported.contains(operator.trim())) throw new IllegalArgumentException(\"Unsupported operator: \" + operator);","typeGuard":null,"tryCatchPattern":"try {\n    renderTemplate(tpl);\n} catch (TemplateException e) {\n    if (e.getMessage().startsWith(\"Not a legal operator\")) {\n        // fix template expression / align qute versions\n    }\n}","preventionTips":["Keep qute-core and the Quarkus/Qute version your templates were built against in sync","Only use documented operators in {when}/{if} expressions","When building expressions programmatically, use the supported Operator enum constants only"],"tags":["qute","template","template-exception","operator"],"backgroundTag":"unsupported-operator","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}