quarkusio/quarkus · error · io.quarkus.qute.TemplateException
Parameter names not recorded for <targetClass>: compile the
Error message
Parameter names not recorded for <targetClass>: compile the class with -parameters
What it means
Qute @CheckedTemplate binds interface method parameters to template data by parameter NAME, read from the compiled class bytecode. If the class was compiled without the -parameters javac flag, names are absent (null) and the build fails with this TemplateException. Maven/Gradle must pass -parameters for the module containing the checked template class.
Source
Thrown at extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/QuteProcessor.java:416
if (startsWith.isEmpty()) {
throw new TemplateException(
"No template matching the path " + templatePath + " could be found for: "
+ targetClass.name() + "." + method.name());
} else {
throw new TemplateException(
startsWith + " match the path " + templatePath
+ " but the file suffix is not configured via the quarkus.qute.suffixes property");
}
}
Map<String, String> bindings = new HashMap<>();
List<Type> parameters = method.parameterTypes();
List<String> parameterNames = new ArrayList<>(parameters.size());
for (int i = 0; i < parameters.size(); i++) {
Type type = parameters.get(i);
String name = method.parameterName(i);
if (name == null) {
throw new TemplateException("Parameter names not recorded for " + targetClass.name()
+ ": compile the class with -parameters");
}
bindings.put(name, getCheckedTemplateParameterTypeName(type));
parameterNames.add(name);
}
AnnotationValue requireTypeSafeExpressions = annotation.value(CHECKED_TEMPLATE_REQUIRE_TYPE_SAFE);
ret.add(new CheckedTemplateBuildItem(templatePath, fragmentId, bindings, method, null,
requireTypeSafeExpressions != null ? requireTypeSafeExpressions.asBoolean() : true));
enhancer.implement(method, templatePath, fragmentId, parameterNames, adaptor);
}
transformers.produce(new BytecodeTransformerBuildItem(targetClass.name().toString(),
enhancer));
}
// Find all Java records that implement TemplateInstance and interfaces adapted by CheckedTemplateAdapter
List<DotName> recordInterfaceNames = new ArrayList<>();
recordInterfaceNames.add(Names.TEMPLATE_INSTANCE);
adaptors.keySet().forEach(recordInterfaceNames::add);View on GitHub (pinned to e1c734241f)
Solutions
- Enable parameter names in Maven: in maven-compiler-plugin set <configuration><parameters>true</parameters></configuration> (Quarkus parent POM does this by default)
- In Gradle, apply the Quarkus plugin or set tasks.withType(JavaCompile) { options.parameters = true }
- Rebuild the module containing the @CheckedTemplate class after enabling -parameters
- If the class comes from a dependency, compile it yourself with -parameters or convert to inline templates / explicit TemplateData
Example fix
// before (pom.xml) <artifactId>maven-compiler-plugin</artifactId> <!-- no configuration --> // after <artifactId>maven-compiler-plugin</artifactId> <configuration><parameters>true</parameters></configuration>
Defensive patterns
Strategy: validation
Validate before calling
// verify parameter names are recorded before relying on @CheckedTemplate
Class<?> c = com.acme.Templates.class;
for (Method m : c.getDeclaredMethods()) {
if (m.getParameterCount() > 0 && m.getParameterAnnotations().length != m.getParameterCount()) {
throw new IllegalStateException("Recompile with -parameters: " + c);
}
}
// or: javap -parameters target/classes/com/acme/Templates.class Prevention
- Always keep maven-compiler-plugin <parameters>true</parameters> or Gradle options.parameters = true
- Inherit from the Quarkus parent POM/BOM which sets it by default
- Never compile @CheckedTemplate classes in dependency JARs built without -parameters
- Run mvn dependency:purge/local-repository cleanups when upgrading Quarkus
When it happens
Trigger: A @CheckedTemplate interface method declares parameters, and method.parameterName(i) returns null during collectCheckedTemplates because the class file has no MethodParameters attribute (compiled with default javac settings without -parameters).
Common situations: Building with a plain javac or an old pom.xml lacking maven-compiler-plugin <parameters>true</parameters>; adding a Quarkus module outside the standard Quarkus parent POM; third-party/generated classes annotated with @CheckedTemplate compiled elsewhere; Gradle build without 'options.parameters = true' or without the Quarkus plugin applying it.
Related errors
- Parameter names not recorded for <recordClass>: compile the
- Parameter names not recorded for : compile the class with -p
- Message bundle name [%s] declared on %s must be a valid name
- Message bundle interface name conflict - [%s] is used for bo
- @MessageBundle must be declared on an interface: {bundleClas
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/988f3b1852ece080.
Report an issue: GitHub.