quarkusio/quarkus · error · IllegalArgumentException
Unsupported type '" + notBodyTargetType + "' used with '" +
Error message
Unsupported type '" + notBodyTargetType + "' used with '" + NOT_BODY + "'. Offending method is '" + jandexMethod.declaringClass().name() + "#" + jandexMethod.name()
What it means
A parameter annotated to be treated as a non-body URL source (NOT_BODY / @BaseUrl style) must be assignable to the supported URL types handled by the generator: String, java.net.URL, or java.net.URI. Any other declared type cannot be converted to a WebTarget, so the generator throws an IllegalArgumentException naming the type and method.
Source
Thrown at extensions/resteasy-reactive/rest-client-jaxrs/deployment/src/main/java/io/quarkus/jaxrs/client/reactive/deployment/JaxrsClientReactiveProcessor.java:1055
MethodParameterInfo baseUrlMethodParam = notBodyAnnotations.get(0).target().asMethodParameter();
DotName notBodyTargetType = baseUrlMethodParam.type().name();
ResultHandle methodParam = methodCreator.getMethodParam(baseUrlMethodParam.position());
AssignableResultHandle newUri = methodCreator.createVariable(java.net.URI.class);
BytecodeCreator methodParamNotNull = methodCreator.ifNotNull(methodParam).trueBranch();
if (STRING.equals(notBodyTargetType)) {
methodParamNotNull.assign(newUri, methodParamNotNull.newInstance(URI_CTOR, methodParam));
} else if (ResteasyReactiveDotNames.URL.equals(notBodyTargetType)) {
methodParamNotNull.assign(newUri,
methodParamNotNull.invokeVirtualMethod(
MethodDescriptor.ofMethod(java.net.URL.class, "toURI", java.net.URI.class),
methodParam));
} else if (URI.equals(notBodyTargetType)) {
methodParamNotNull.assign(newUri, methodParam);
} else {
throw new IllegalArgumentException("Unsupported type '" + notBodyTargetType + "' used with '"
+ NOT_BODY + "'. Offending method is '" + jandexMethod.declaringClass().name() + "#"
+ jandexMethod.name());
}
ResultHandle newInputTarget;
if (observabilityIntegrationNeeded) {
// we need to apply the ClientObservabilityHandler to the inputTarget field without altering it
newInputTarget = methodParamNotNull.invokeVirtualMethod(
MethodDescriptor.ofMethod(WebTargetImpl.class, "withNewUri", WebTargetImpl.class,
java.net.URI.class, ClientRestHandler.class),
methodParamNotNull.readInstanceField(inputTargetField, methodParamNotNull.getThis()),
newUri,
methodParamNotNull.newInstance(
MethodDescriptor.ofConstructor(ClientObservabilityHandler.class, String.class),
methodParamNotNull.load(templatePath(restClientInterface, method))));
} else {
// just read the inputTarget field and call withNewUri on it
newInputTarget = methodParamNotNull.invokeVirtualMethod(View on GitHub (pinned to e1c734241f)
Solutions
- Change the parameter type to String, java.net.URL, or java.net.URI
- Convert the custom type to one of the supported types at the call site (e.g. path.toUri())
- Remove the URL annotation if the parameter was not intended as a base URL
Example fix
// before String get(@BaseUrl Path base); // after String get(@BaseUrl java.net.URI base);
Defensive patterns
Strategy: type-guard
Validate before calling
for (var p : method.getParameters()) { if (p.isAnnotationPresent(BaseUrl.class)) { Class<?> t = p.getType(); if (t != String.class && t != java.net.URL.class && t != java.net.URI.class) throw new IllegalStateException("@BaseUrl parameter must be String/URL/URI: " + p); } } Type guard
boolean isUrlType(Class<?> t) { return t == String.class || t == java.net.URL.class || t == java.net.URI.class; } Try / catch
try { client.get(); } catch (IllegalArgumentException e) { if (e.getMessage().contains("Unsupported type")) { log.error("Convert @BaseUrl parameter to String/URL/URI"); } throw e; } Prevention
- Restrict URL-source parameters to String, java.net.URL, or java.net.URI
- Convert Path/config objects at the call site before invoking the client
- Never annotate arbitrary types with @BaseUrl
- Document supported parameter types in client interfaces
When it happens
Trigger: Declaring a REST client method parameter whose type is not String, java.net.URL, or java.net.URI but which is annotated as a URL-source parameter (e.g. @BaseUrl on an Object, Path, or custom type).
Common situations: Using java.nio.file.Path or a custom wrapper for the base URL; passing a config object instead of a String; older code written for a different HTTP client API.
Related errors
- Unsupported field type for multipart response mapping: " + t
- 'quarkus-narayana-lra' can only work if 'quarkus-rest-client
- Not possible to define the scope %s for the REST client %s
- Method ${class}#${method} has an unsupported return type for
- Method ${class}#${method} has an unsupported return type for
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/aef137ef5b0878bf.
Report an issue: GitHub.