quarkusio/quarkus · error · TemplateException

Not a short-circuiting operator:

Error message

Not a short-circuiting operator: 

What it means

Qute's {if} section supports only the short-circuiting operators && (and) and || (or). The Operator enum's eval() method is only valid for those; any other operator reaching this default branch is a parser/internal logic bug because non-short-circuiting operators are evaluated elsewhere via evalNeitherIsShortCircuiting(). The library throws TemplateException to signal an unexpected operator state rather than silently returning a wrong boolean.

Source

Thrown at independent-projects/qute/core/src/main/java/io/quarkus/qute/IfSectionHelper.java:543

                case GT:
                    return result > 0;
                case LE:
                    return result <= 0;
                case LT:
                    return result < 0;
                default:
                    return false;
            }
        }

        Boolean evaluate(Object op1) {
            switch (this) {
                case AND:
                    return isFalsy(op1) ? Boolean.FALSE : null;
                case OR:
                    return isFalsy(op1) ? null : Boolean.TRUE;
                default:
                    throw new TemplateException("Not a short-circuiting operator: " + this);
            }
        }

        boolean isShortCircuiting() {
            return AND.equals(this) || OR.equals(this);
        }

        boolean isBinary() {
            return !NOT.equals(this);
        }

        static Operator from(String value) {
            if (value == null || value.isEmpty()) {
                return null;
            }
            for (Operator operator : values()) {
                if (operator.aliases.contains(value)) {
                    return operator;

View on GitHub (pinned to e1c734241f)

Solutions

  1. Check which operator is being evaluated; ensure && and || are written as 'and'/'&&' and 'or'/'||' in the template, not a custom/typo operator like '&' alone
  2. If you patched Qute to add an operator, update the switch in Operator.eval() (or route the operator to isShortCircuiting()==false handling) so the default branch is unreachable
  3. Verify your Qute version matches a released one; report the template/params upstream if a stock template triggers it

Example fix

// before (custom NOT added to enum, falls into default)
case NOT: return isFalsy(op1) ? Boolean.TRUE : Boolean.FALSE; // missing -> default throws
// after
boolean isShortCircuiting() {
    return AND.equals(this) || OR.equals(this);
}
// route non-short-circuiting operators through the non-short-circuit eval path instead of Operator.eval()
Defensive patterns

Strategy: try-catch

Validate before calling

// only operators && and || are short-circuiting
if (!op.equals("&&") && !op.equals("||") && !op.equals("and") && !op.equals("or")) {
    throw new IllegalArgumentException("Unsupported if-operator: " + op);
}

Type guard

boolean isShortCircuiting(String op) {
    return "&&".equals(op) || "||".equals(op) || "and".equals(op) || "or".equals(op);
}

Try / catch

try {
    engine.parse(templateContent);
} catch (TemplateException e) {
    if (e.getMessage().startsWith("Not a short-circuiting operator")) {
        log.error("Template uses an unsupported if-operator; check Qute version/custom patches", e);
    }
    throw e;
}

Prevention

When it happens

Trigger: Calling the package-private Operator.eval(operands) method on an operator other than AND or OR; in practice this only happens if a new Operator enum constant (e.g. NOT) is added but not routed through the correct evaluation path, or if reflection/internal code dispatches a non-short-circuiting operator to this switch.

Common situations: Developers extending Qute's if-section operator set (custom patches to IfSectionHelper) or contributing new operators to the Qute parser; end users should essentially never see this from a template unless they hit a framework bug.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/d2ecd0cdc19d8dcc. Report an issue: GitHub.