{"record":{"id":"eacf5f2c1bc08962","repo":"quarkusio/quarkus","slug":"value-param-not-present","errorCode":null,"errorMessage":"Value param not present","messagePattern":"Value param not present","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"independent-projects/qute/core/src/main/java/io/quarkus/qute/WhenSectionHelper.java","lineNumber":126,"sourceCode":"            return ParametersInfo.builder().addParameter(VALUE).build();\n        }\n\n        @Override\n        public WhenSectionHelper initialize(SectionInitContext context) {\n            return new WhenSectionHelper(context);\n        }\n\n        @Override\n        public List<String> getBlockLabels() {\n            return ImmutableList.of(IS, CASE, ELSE);\n        }\n\n        @Override\n        public Scope initializeBlock(Scope previousScope, BlockInfo block) {\n            if (block.getLabel().equals(MAIN_BLOCK_NAME)) {\n                String value = block.getParameters().get(VALUE);\n                if (value == null) {\n                    throw new IllegalStateException(\"Value param not present\");\n                }\n                Expression valueExpr = block.addExpression(VALUE, value);\n                if (valueExpr.hasTypeInfo()) {\n                    // If type info is available we do add the expression id\n                    previousScope.putAttribute(VALUE_EXPR_ID, valueExpr.getGeneratedId());\n                }\n            } else if (ELSE.equals(block.getLabel())) {\n                // No special handling required for \"else\"\n            } else if (IS.equals(block.getLabel()) || CASE.equals(block.getLabel())) {\n                Object valueExprId = previousScope.getAttribute(VALUE_EXPR_ID);\n                int added = 0;\n                Iterator<String> it = block.getParameters().values().iterator();\n                while (it.hasNext()) {\n                    String param = it.next();\n                    if (added == 0 && it.hasNext()) {\n                        // Skip the operator param\n                        continue;\n                    }","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/qute/core/src/main/java/io/quarkus/qute/WhenSectionHelper.java#L108-L144","documentation":"Qute's {#when} section helper requires each branch block (and the main block) to carry a `value` parameter that specifies what the branch matches against. WhenSectionHelper.initializeBlock throws this IllegalStateException when the `value` parameter is absent from a block, i.e. the template's when/case structure is malformed.","triggerScenarios":"A `{#when}` or `{#is}`/`{#case}` block is declared without the `value` parameter, so `block.getParameters().get(VALUE)` returns null at WhenSectionHelper.java:126; this occurs at template parsing/build time, not at rendering.","commonSituations":"Writing `{#is}` with no argument inside a `{#when}` block; template refactoring that dropped the match value; copy-pasting case blocks and removing the parameter; typos in the parameter name.","solutions":["Supply the match value on each branch: `{#is value}...{/is}` or `{#when item.status}{#is 'OK'}...{/when}`.","Verify every `{#is}`/`{#case}` block inside `{#when}` has exactly one value parameter.","Check for typos in the parameter name (it must literally be `value` for the main block form)."],"exampleFix":"<!-- before (template) -->\n{#when item.status}\n  {#is}OK{/is}\n{/when}\n<!-- after (template) -->\n{#when item.status}\n  {#is 'OK'}All good{/is}\n{/when}","handlingStrategy":"validation","validationCode":"// template parse-time check: every {#is}/{#case} block must carry a value\n// {#when status}{#is 'OK'}...{/is}{/when}\n// This error is thrown during template initialization, so render/parse in tests to catch it early.","typeGuard":null,"tryCatchPattern":"try {\n    template = Engine.builder().addSectionHelper(new WhenSectionHelperFactory()).build().parse(tpl);\n} catch (IllegalStateException e) {\n    throw new TemplateInvalidException(\"malformed {#when} block: \" + e.getMessage(), e);\n}","preventionTips":["Always give each {#is}/{#case} branch an explicit value parameter","Parse all templates in CI tests so malformed when-blocks fail the build","Watch for parameter-name typos (value) after refactors"],"tags":["qute","template","section-helper","missing-parameter"],"backgroundTag":"missing-required-argument","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"}