quarkusio/quarkus · error · IllegalStateException
A receiver method must not be private:
Error message
A receiver method must not be private:
What it means
The signals extension requires receiver methods (those with a @Receives parameter) to be non-private so the generated invoker can call them on the bean. During deployment, collectReceivers rejects a private @Receives method with this IllegalStateException, including the method description.
Source
Thrown at extensions/signals/deployment/src/main/java/io/quarkus/signals/deployment/SignalsProcessor.java:149
if (!params.isEmpty()) {
for (MethodParameterInfo param : params) {
if (param.hasDeclaredAnnotation(DotNames.RECEIVES)) {
if (signalParam != null) {
throw new IllegalStateException(
"A receiver method must have exactly one parameter annotated with @Receives: "
+ methodDesc(method));
}
signalParam = param;
}
}
}
if (!seenMethods.add(method.signatureKey())) {
// Overridden by a subclass
continue;
}
if (signalParam != null) {
if (Modifier.isPrivate(method.flags())) {
throw new IllegalStateException(
"A receiver method must not be private: " + methodDesc(method));
}
if (Modifier.isStatic(method.flags())) {
throw new IllegalStateException(
"A receiver method must not be static: " + methodDesc(method));
}
ExecutionModel executionModel = getExecutionModel(method);
if (!receiverExecutorImplementation.isSupported(executionModel)) {
throw new IllegalStateException(
"%s execution model is not supported: %s".formatted(executionModel, methodDesc(method)));
}
InvokerBuilder invokerBuilder = invokerFactory.createInvoker(bean, method)
.withInstanceLookup();
if (params.size() > 1) {
for (MethodParameterInfo param : params) {
if (param != signalParam) {
invokerBuilder.withArgumentLookup(param.position());
}View on GitHub (pinned to e1c734241f)
Solutions
- Remove 'private' and make the method package-private, protected, or public
- Keep the private logic internal and have a non-private @Receives method delegate to it
- Note the same rule bans static receiver methods - make it an instance method too
Example fix
// before
private void onSignal(@Receives Signal signal) {...}
// after
void onSignal(@Receives Signal signal) {...} Defensive patterns
Strategy: validation
Validate before calling
// Audit receiver methods before build: must not be private or static // grep -rnA1 "@Receives" src/main/java | check 'private'/'static' on enclosing method
Prevention
- Make all @Receives methods package-private or public instance methods
- Beware IDE 'extract method' defaults producing private handlers
- Delegate from a non-private receiver to private helpers if encapsulation is needed
- Avoid static receivers - the extension rejects them likewise
When it happens
Trigger: Declaring private void handle(@Receives Signal signal) in a CDI bean; the build step walks the class hierarchy, sees the method has a signalParam and Modifier.isPrivate is true, and fails the build.
Common situations: Making a signal handler private for encapsulation (IDE default when extracting methods); moving an existing handler to private during refactoring; adding @Receives to an internal helper method.
Related errors
- A receiver method must have exactly one parameter annotated
- A receiver method must not be static:
- @CachedResults class must be an interface or declare a no-ar
- Not possible to define the scope %s for the REST client %s
- %s execution model is not supported: %s
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/0bbf600fca60c3fa.
Report an issue: GitHub.