quarkusio/quarkus · error

Object param not present

Error message

Object param not present

What it means

The {with} section requires an object parameter: {#with object}...{/}. WithSectionHelper.initializeBlock() throws IllegalStateException when the parameter named 'object' is absent from the section's parameters, because there is nothing to bind the nested scope to.

Source

Thrown at independent-projects/qute/core/src/main/java/io/quarkus/qute/WithSectionHelper.java:54

            return ImmutableList.of(WITH);
        }

        @Override
        public ParametersInfo getParameters() {
            return ParametersInfo.builder().addParameter(OBJECT).build();
        }

        @Override
        public WithSectionHelper initialize(SectionInitContext context) {
            return new WithSectionHelper(context);
        }

        @Override
        public Scope initializeBlock(Scope previousScope, BlockInfo block) {
            if (block.getLabel().equals(MAIN_BLOCK_NAME)) {
                String object = block.getParameters().get(OBJECT);
                if (object == null) {
                    throw new IllegalStateException("Object param not present");
                }
                block.addExpression(OBJECT, object);
                return previousScope;
            } else {
                return previousScope;
            }
        }

    }
}

View on GitHub (pinned to e1c734241f)

Solutions

  1. Add the object expression to the section: {#with myObject}...{/}.
  2. Verify the #with tag is not empty (no stray whitespace-only parameter removed by a minifier/template formatter).
  3. If the value may be absent, wrap in a null check: {#if obj}{#with obj}...{/}{/}.
  4. Re-run the app after fixing; the error occurs at block initialization so the template must be reparsed.

Example fix

// before
{#with}
  {name}
{/}
// after
{#with user.profile}
  {name}
{/}
Defensive patterns

Strategy: validation

Validate before calling

// verify the with section always carries a parameter
if (templateBody.matches("(?s).*\\{#with\\s*\\}.*")) {
    throw new TemplateValidationException("{#with} requires an object parameter");
}

Try / catch

try {
    engine.parse(templateContent);
} catch (IllegalStateException e) {
    if ("Object param not present".equals(e.getMessage())) {
        // report template authoring error: {#with} missing parameter
    }
}

Prevention

When it happens

Trigger: Writing {#with} (or {#with nested.foo}) with no parameter, e.g. {#with}{/}; an empty expression after #with; a template parsing quirk that drops the parameter.

Common situations: Hand-edited templates where the parameter was accidentally deleted; copy-pasting a {with} block and forgetting to fill in the object expression; generated templates with an empty variable placeholder.

Related errors


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