{"record":{"id":"fb7fa64011b29ef5","repo":"quarkusio/quarkus","slug":"expression-not-found-for-param","errorCode":null,"errorMessage":"Expression not found for param []: ","messagePattern":"Expression not found for param \\[\\]: ","errorType":"exception","errorClass":"TemplateException","httpStatus":null,"severity":"error","filePath":"independent-projects/qute/core/src/main/java/io/quarkus/qute/IfSectionHelper.java","lineNumber":738,"sourceCode":"                block)\n                .forEachRemaining(split::add);\n        return parseParams(split, block);\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    static Condition createCondition(Object param, SectionBlock block, Operator operator, SectionInitContext context) {\n\n        Condition condition;\n\n        if (param instanceof String) {\n            String stringParam = param.toString();\n            boolean logicalComplement = stringParam.startsWith(LOGICAL_COMPLEMENT);\n            if (logicalComplement) {\n                stringParam = stringParam.substring(1);\n            }\n            Expression expr = block.expressions.get(stringParam);\n            if (expr == null) {\n                throw new TemplateException(\"Expression not found for param [\" + stringParam + \"]: \" + block);\n            }\n            condition = new OperandCondition(operator, expr);\n        } else if (param instanceof List) {\n            List<Object> params = (List<Object>) param;\n            if (params.size() == 1) {\n                return createCondition(params.get(0), block, operator, context);\n            }\n\n            List<Condition> conditions = new ArrayList<>();\n            Operator nextOperator = null;\n\n            for (Object p : params) {\n                if (p instanceof Operator) {\n                    nextOperator = (Operator) p;\n                } else {\n                    conditions.add(createCondition(p, block, nextOperator, context));\n                    nextOperator = null;\n                }","sourceCodeStart":720,"sourceCodeEnd":756,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/qute/core/src/main/java/io/quarkus/qute/IfSectionHelper.java#L720-L756","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\n{#if active && }Done{/if}\n// after\n{#if active && complete}Done{/if}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    template.render(data);\n} catch (TemplateException e) {\n    if (e.getMessage().startsWith(\"Expression not found for param\")) {\n        log.error(\"Malformed {#if} operand; check the condition syntax\", e);\n    }\n    throw e;\n}","preventionTips":["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"],"tags":["qute","template","expression","if-section"],"backgroundTag":"template-syntax-error","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}