quarkusio/quarkus · error · TemplateException

Parameter names not recorded for : compile the class with -p

Error message

Parameter names not recorded for : compile the class with -parameters

What it means

Qute needs parameter names of @TemplateAttribute-annotated parameters to build the generated invoker. When the method has no -parameters compiler flag, Jandex cannot supply parameter names and the extension method declares no explicit name in @TemplateAttribute, so a TemplateException is thrown.

Source

Thrown at independent-projects/qute/generator/src/main/java/io/quarkus/qute/generator/ExtensionMethodGenerator.java:950

    }

    public static final class Parameters implements Iterable<Param> {

        final boolean isNameParameterRequired;
        final List<Param> params;

        public Parameters(MethodInfo method, boolean isNameParameterRequired, boolean hasNamespace) {
            this.isNameParameterRequired = isNameParameterRequired;
            List<Type> parameters = method.parameterTypes();
            Map<Integer, String> attributeParamNames = new HashMap<>();
            for (AnnotationInstance annotation : method.annotations()) {
                if (annotation.target().kind() == org.jboss.jandex.AnnotationTarget.Kind.METHOD_PARAMETER
                        && annotation.name().equals(TEMPLATE_ATTRIBUTE)) {
                    AnnotationValue value = annotation.value();
                    int position = (int) annotation.target().asMethodParameter().position();
                    String name = value != null ? value.asString() : method.parameterName(position);
                    if (name == null) {
                        throw new TemplateException("Parameter names not recorded for " + method.declaringClass().name()
                                + ": compile the class with -parameters");
                    }
                    attributeParamNames.put(position, name);
                }
            }
            List<Param> params = new ArrayList<>(parameters.size());
            int indexed = 0;
            for (int i = 0; i < parameters.size(); i++) {
                if (attributeParamNames.containsKey(i)) {
                    params.add(new Param(attributeParamNames.get(i), parameters.get(i), i, ParamKind.ATTR));
                } else if (indexed == 0) {
                    indexed++;
                    if (hasNamespace) {
                        // Namespace and matches any or regex - first indexed param is the name
                        if (isNameParameterRequired) {
                            params.add(new Param(method.parameterName(i), parameters.get(i), i, ParamKind.NAME));
                        } else {
                            params.add(new Param(method.parameterName(i), parameters.get(i), i, ParamKind.EVAL));

View on GitHub (pinned to e1c734241f)

Solutions

  1. Compile with the -parameters flag (set <maven.compiler.parameters>true</maven.compiler.parameters> in Maven)
  2. Provide the name explicitly: @TemplateAttribute("myName") instead of relying on the parameter name
  3. Check that the annotation processor/toolchain isn't stripping parameter name metadata

Example fix

// before
@TemplateAttribute Object locale
// after
@TemplateAttribute("locale") Object locale
// or in pom.xml
// <maven.compiler.parameters>true</maven.compiler.parameters>
Defensive patterns

Strategy: validation

Validate before calling

<!-- pom.xml -->
<properties>
  <maven.compiler.parameters>true</maven.compiler.parameters>
</properties>

Prevention

When it happens

Trigger: A template extension method parameter annotated @TemplateAttribute without an explicit value, compiled without javac's -parameters flag; Qute's generator then gets null from method.parameterName(position).

Common situations: Maven/Gradle builds missing maven.compiler.parameters=true; annotation processing or AOT pipeline that strips parameter names; IDE builds without -parameters while the app expects it.

Related errors


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