quarkusio/quarkus · error
Value param not present
Error message
Value param not present
What it means
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.
Source
Thrown at independent-projects/qute/core/src/main/java/io/quarkus/qute/WhenSectionHelper.java:126
return ParametersInfo.builder().addParameter(VALUE).build();
}
@Override
public WhenSectionHelper initialize(SectionInitContext context) {
return new WhenSectionHelper(context);
}
@Override
public List<String> getBlockLabels() {
return ImmutableList.of(IS, CASE, ELSE);
}
@Override
public Scope initializeBlock(Scope previousScope, BlockInfo block) {
if (block.getLabel().equals(MAIN_BLOCK_NAME)) {
String value = block.getParameters().get(VALUE);
if (value == null) {
throw new IllegalStateException("Value param not present");
}
Expression valueExpr = block.addExpression(VALUE, value);
if (valueExpr.hasTypeInfo()) {
// If type info is available we do add the expression id
previousScope.putAttribute(VALUE_EXPR_ID, valueExpr.getGeneratedId());
}
} else if (ELSE.equals(block.getLabel())) {
// No special handling required for "else"
} else if (IS.equals(block.getLabel()) || CASE.equals(block.getLabel())) {
Object valueExprId = previousScope.getAttribute(VALUE_EXPR_ID);
int added = 0;
Iterator<String> it = block.getParameters().values().iterator();
while (it.hasNext()) {
String param = it.next();
if (added == 0 && it.hasNext()) {
// Skip the operator param
continue;
}View on GitHub (pinned to e1c734241f)
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).
Example fix
<!-- before (template) -->
{#when item.status}
{#is}OK{/is}
{/when}
<!-- after (template) -->
{#when item.status}
{#is 'OK'}All good{/is}
{/when} Defensive patterns
Strategy: validation
Validate before calling
// template parse-time check: every {#is}/{#case} block must carry a value
// {#when status}{#is 'OK'}...{/is}{/when}
// This error is thrown during template initialization, so render/parse in tests to catch it early. Try / catch
try {
template = Engine.builder().addSectionHelper(new WhenSectionHelperFactory()).build().parse(tpl);
} catch (IllegalStateException e) {
throw new TemplateInvalidException("malformed {#when} block: " + e.getMessage(), e);
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- Invalid template link [${templateLink}] - Expeting a link th
- Unable to instantiate SectionHelperFactory: <engineConfigCla
- Templates that are not backed by a file must provide extensi
- Literal must not be null
- Expression is not a literal:
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/eacf5f2c1bc08962.
Report an issue: GitHub.