quarkusio/quarkus · error · RestClientDefinitionException
${annotationName} method ${methodName} not found on ${declar
Error message
${annotationName} method ${methodName} not found on ${declaringClass} What it means
Thrown at build time when the valueFrom class referenced by @ClientQueryParam/@ClientHeaderParam is an interface (so the enricher generates a mock implementation), but the declared method name does not exist on that interface. The enricher cannot resolve the value-producing method so client generation fails.
Source
Thrown at extensions/resteasy-reactive/rest-client/deployment/src/main/java/io/quarkus/rest/client/reactive/deployment/MicroProfileRestClientEnricher.java:448
if (paramValueMethod.parametersCount() == 0) {
paramValue = methodCallCreator.invokeStaticMethod(paramValueMethod);
} else if (paramValueMethod.parametersCount() == 1 && isString(paramValueMethod.parameterType(0))) {
paramValue = methodCallCreator.invokeStaticMethod(paramValueMethod, methodCallCreator.load(paramName));
} else {
throw new RestClientDefinitionException(
annotationName + " method " + declaringClass.toString() + "#" + staticMethodName
+ " has too many parameters, at most one parameter, param name, expected");
}
} else {
// interface method
String mockName = mockInterface(declaringClass, generatedClasses, index);
ResultHandle interfaceMock = methodCallCreator.newInstance(MethodDescriptor.ofConstructor(mockName));
paramValueMethod = findMethod(declaringClass, declaringClass, methodName, clientParamAnnotation.toString());
if (paramValueMethod == null) {
throw new RestClientDefinitionException(
annotationName + " method " + methodName + " not found on " + declaringClass);
}
if (paramValueMethod.parametersCount() == 0) {
paramValue = methodCallCreator.invokeInterfaceMethod(paramValueMethod, interfaceMock);
} else if (paramValueMethod.parametersCount() == 1 && isString(paramValueMethod.parameterType(0))) {
paramValue = methodCallCreator.invokeInterfaceMethod(paramValueMethod, interfaceMock,
methodCallCreator.load(paramName));
} else {
throw new RestClientDefinitionException(
annotationName + " method " + declaringClass + "#" + methodName
+ " has too many parameters, at most one parameter, param name, expected");
}
}
Type returnType = paramValueMethod.returnType();
ResultHandle valuesList;View on GitHub (pinned to e1c734241f)
Solutions
- Ensure the interface declares a method with the exact expected name and compatible signature
- Check the annotation value matches the method name in the interface
- Rebuild the index/recompile so the Jandex index sees the method
Example fix
// before
interface Values { /* no getToken */ }
@ClientQueryParam(value = "token", valueFrom = Values.class)
// after
interface Values { String getToken(String name); }
@ClientQueryParam(value = "token", valueFrom = Values.class) Defensive patterns
Strategy: validation
Validate before calling
// Verify the interface declares the expected method before using it in the annotation
Class<?> c = Values.class;
boolean ok = java.util.Arrays.stream(c.getDeclaredMethods())
.anyMatch(m -> m.getName().equals("getToken") && m.getParameterCount() <= 1);
if (!ok) throw new IllegalStateException("Values#getToken missing"); Prevention
- Keep valueFrom interfaces and annotations updated together
- Grep for valueFrom references when renaming methods
- Rebuild with the Jandex index refreshed after adding methods
When it happens
Trigger: @ClientQueryParam(value="x", valueFrom=MyInterface.class) where MyInterface has no method matching the required name lookup (findMethod with the annotation's toString), e.g. typo in method name or method removed after a refactor/version upgrade.
Common situations: Renaming interface methods after upgrading the library, referencing a value class whose API changed, or misspelling the method expected by the annotation processing.
Related errors
- Duplicate ${annotationName} annotation for parameter: ${name
- Class ${className} used in ${annotationName} on ${declaringC
- ${annotationName} method ${declaringClass}#${staticMethodNam
- ${annotationName} method ${declaringClass}#${methodName} has
- Invalid @ClientHeaderParam definition, unable to determine t
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/a6b01e44b3ea2c17.
Report an issue: GitHub.