quarkusio/quarkus · error
Multiple extension methods match 0 params and the name %s: %
Error message
Multiple extension methods match 0 params and the name %s: %s. Specify priorities to avoid this problem.
What it means
In a namespace (e.g. 'config' or 'time'), when a name with zero parameters matches more than one extension method, Qute cannot decide which one to invoke. It throws IllegalStateException unless distinct priorities disambiguate the methods.
Source
Thrown at independent-projects/qute/generator/src/main/java/io/quarkus/qute/generator/ExtensionMethodGenerator.java:360
for (Map.Entry<String, List<NamespaceExtensionMethodInfo>> mne : matchingName.entrySet()) {
String matchName = mne.getKey();
boolean matchAny = matchName.equals(TemplateExtension.ANY);
bc.block(nested -> {
// Test name
if (!matchAny) {
nested.ifNot(nested.exprEquals(name, Const.of(matchName)),
notMatching -> notMatching.break_(nested));
}
// Test number of evaluated params
nested.if_(nested.ne(paramsCount, Const.of(numberOfParams)),
notEqual -> notEqual.break_(nested));
List<NamespaceExtensionMethodInfo> methods = mne.getValue();
if (numberOfParams == 0) {
// No params -> there must be exactly one extension method
if (methods.size() > 1) {
throw new IllegalStateException(
"Multiple extension methods match 0 params and the name %s: %s. Specify priorities to avoid this problem."
.formatted(matchName, methods));
}
nested.return_(doInvokeNoParams(nested, name, evalContext, methods.get(0)));
} else {
evaluateAndInvoke(nested, evalContext, name, methods);
}
});
}
// Then handle all methods matching the same number of params and the _same names_
for (Map.Entry<Set<String>, List<NamespaceExtensionMethodInfo>> mne : matchingNames.entrySet()) {
Set<String> matchNames = mne.getKey();
bc.block(nested -> {
// Test that any of the names matches
nested.block(nested2 -> {
for (String matchName : matchNames.stream().sorted().toList()) {View on GitHub (pinned to e1c734241f)
Solutions
- Set distinct priorities via @TemplateExtension(priority = N) so one method wins
- Rename one of the conflicting methods
- Remove the duplicate extension method
Example fix
// before
@TemplateExtension(namespace = "time", matchName = "now")
static String now() { ... }
// duplicated in another class
// after
@TemplateExtension(namespace = "time", matchName = "now", priority = 10)
static String now() { ... } Defensive patterns
Strategy: validation
Validate before calling
// Detect duplicate no-arg namespace extensions with same name at app startup test:
Map<String,Long> dup = methods.stream().collect(groupingBy(m -> name(m), counting()));
if (dup.values().stream().anyMatch(c -> c > 1)) throw new IllegalStateException("Ambiguous namespace extension"); Prevention
- Assign explicit priorities to all namespace extensions
- Avoid duplicate names across extension classes
- Run a template smoke test in CI that renders affected expressions
When it happens
Trigger: Registering two or more namespace extension methods with the same name, zero parameters, and equal priority; raised in generateNamespaceResolver during template class generation.
Common situations: Two @TemplateExtension(matchName="now", namespace="time") methods in different classes; duplicated extension methods after merging libraries; same-name overloads that differ only in return type.
Related errors
- Multiple extension methods match 0 params and the names %s:
- Message bundle name [%s] declared on %s must be a valid name
- Could not find component reference
- Could not find component reference
- Message bundle interface name conflict - [%s] is used for bo
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/d66f0e2abc0704b6.
Report an issue: GitHub.