quarkusio/quarkus · error · DefinitionException
No disposed parameters found for ${disposerMethod}
Error message
No disposed parameters found for ${disposerMethod} What it means
A disposer method must have exactly one @Disposes-annotated parameter identifying what it disposes. DisposerInfo.initDisposedParam throws this DefinitionException when the disposer method has no @Disposes parameter at all.
Source
Thrown at independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/DisposerInfo.java:101
if (resultingQualifiers.isEmpty()) {
resultingQualifiers.add(AnnotationInstance.builder(Default.class).build());
}
return resultingQualifiers;
}
Type getDisposedParameterType() {
return disposerMethod.parameterType(disposedParameter.position());
}
MethodParameterInfo initDisposedParam(MethodInfo disposerMethod) {
List<MethodParameterInfo> disposedParams = new ArrayList<>();
for (AnnotationInstance annotation : disposerMethod.annotations()) {
if (Kind.METHOD_PARAMETER == annotation.target().kind() && annotation.name().equals(DotNames.DISPOSES)) {
disposedParams.add(annotation.target().asMethodParameter());
}
}
if (disposedParams.isEmpty()) {
throw new DefinitionException("No disposed parameters found for " + disposerMethod);
} else if (disposedParams.size() > 1) {
throw new DefinitionException("Multiple disposed parameters found for " + disposerMethod);
}
return disposedParams.get(0);
}
}
View on GitHub (pinned to e1c734241f)
Solutions
- Annotate exactly one parameter of the disposer method with @Disposes.
- Ensure that parameter's type matches the type produced by the corresponding @Produces method.
- If the method was not meant to be a disposer, remove any mismatched method parameters or move the method out of the producing bean.
- Verify only one parameter carries @Disposes (more than one triggers the sibling 'Multiple disposed parameters' error).
Example fix
// before
void close(Resource r) { r.shutdown(); } // missing @Disposes
// after
void close(@Disposes Resource r) { r.shutdown(); } Defensive patterns
Strategy: validation
Validate before calling
long disposed = Arrays.stream(disposerMethod.getParameters())
.filter(p -> p.isAnnotationPresent(jakarta.enterprise.inject.Disposes.class)).count();
if (disposed == 0) throw new IllegalStateException("Disposer must have one @Disposes parameter: " + disposerMethod); Prevention
- Always annotate exactly one disposer parameter with @Disposes.
- Match the disposed parameter type to the producer's return type.
- Let the IDE generate disposer methods instead of typing signatures by hand.
When it happens
Trigger: A method registered as a disposer (Arc found it during bean discovery as the disposer of a producer) has zero parameters annotated @Disposes — e.g. the annotation was forgotten, removed, or applied to the wrong method.
Common situations: Typing the disposer signature by hand and omitting @Disposes; moving the annotation to the wrong parameter; upgrading Arc/Quarkus where stricter validation catches an old signature; IDE auto-complete dropping the annotation.
Related errors
- No producer method or field declared by the bean class that
- Multiple disposer methods found for producer '${producer}' d
- Disposer method must not be annotated @Produces (alternative
- An interceptor method cannot be marked @Produces or @Dispose
- Unsupported injection point target: <injectionPoint>
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/b6c81e6b5748f40f.
Report an issue: GitHub.