quarkusio/quarkus · error · TemplateException
Expression not found for param []:
Error message
Expression not found for param []:
What it means
After section parameters are parsed, IfSectionHelper looks up each parameter's parsed Expression in a map keyed by the parameter string. If a param string has no corresponding Expression, the condition graph cannot be built and TemplateException is thrown. This is an internal consistency failure: a param survived parsing but never produced an Expression entry.
Source
Thrown at independent-projects/qute/core/src/main/java/io/quarkus/qute/IfSectionHelper.java:738
block)
.forEachRemaining(split::add);
return parseParams(split, block);
}
@SuppressWarnings("unchecked")
static Condition createCondition(Object param, SectionBlock block, Operator operator, SectionInitContext context) {
Condition condition;
if (param instanceof String) {
String stringParam = param.toString();
boolean logicalComplement = stringParam.startsWith(LOGICAL_COMPLEMENT);
if (logicalComplement) {
stringParam = stringParam.substring(1);
}
Expression expr = block.expressions.get(stringParam);
if (expr == null) {
throw new TemplateException("Expression not found for param [" + stringParam + "]: " + block);
}
condition = new OperandCondition(operator, expr);
} else if (param instanceof List) {
List<Object> params = (List<Object>) param;
if (params.size() == 1) {
return createCondition(params.get(0), block, operator, context);
}
List<Condition> conditions = new ArrayList<>();
Operator nextOperator = null;
for (Object p : params) {
if (p instanceof Operator) {
nextOperator = (Operator) p;
} else {
conditions.add(createCondition(p, block, nextOperator, context));
nextOperator = null;
}View on GitHub (pinned to e1c734241f)
Solutions
- Fix the {#if} expression so every operand is a real expression, no trailing/leading operators or empty operands
- Upgrade/verify your Quarkus version; if a plain template like {#if a || b} triggers this, file a Quarkus bug with the template
- If you build condition params programmatically, ensure each param string was registered as an Expression via the normal Parser.parseParams path
Example fix
// before
{#if active && }Done{/if}
// after
{#if active && complete}Done{/if} Defensive patterns
Strategy: try-catch
Try / catch
try {
template.render(data);
} catch (TemplateException e) {
if (e.getMessage().startsWith("Expression not found for param")) {
log.error("Malformed {#if} operand; check the condition syntax", e);
}
throw e;
} Prevention
- Ensure every {#if} operand is a complete expression (no dangling operators)
- Avoid hand-building section parameter lists; use the documented parser APIs
- Report stock-template occurrences upstream with a reproducer
When it happens
Trigger: Calling the package-private createCondition(...) with a String param absent from block.expressions — typically caused by an empty/blank param string (message shows 'param []'), or custom code feeding params into the if-section helpers that bypassed Parser.parseParams/parseSectionParams.
Common situations: Templates with malformed conditions producing an empty operand (e.g. a dangling operator like {#if a && }— parser-level diagnostics usually catch these first); framework regressions or custom section helpers reusing parseParams with hand-built parameter lists.
Related errors
- Not a binary operator:
- Not a short-circuiting operator:
- Invalid composite parameter found:
- Unsupported param type:
- Invalid template link [${templateLink}] - Expeting a link th
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/fb7fa64011b29ef5.
Report an issue: GitHub.