{"record":{"id":"aef137ef5b0878bf","repo":"quarkusio/quarkus","slug":"unsupported-type-notbodytargettype-used","errorCode":null,"errorMessage":"Unsupported type '\" + notBodyTargetType + \"' used with '\" + NOT_BODY + \"'. Offending method is '\" + jandexMethod.declaringClass().name() + \"#\" + jandexMethod.name()","messagePattern":"Unsupported type '\" \\+ notBodyTargetType \\+ \"' used with '\" \\+ NOT_BODY \\+ \"'\\. Offending method is '\" \\+ jandexMethod\\.declaringClass\\(\\)\\.name\\(\\) \\+ \"#\" \\+ jandexMethod\\.name\\(\\)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"extensions/resteasy-reactive/rest-client-jaxrs/deployment/src/main/java/io/quarkus/jaxrs/client/reactive/deployment/JaxrsClientReactiveProcessor.java","lineNumber":1055,"sourceCode":"\n                        MethodParameterInfo baseUrlMethodParam = notBodyAnnotations.get(0).target().asMethodParameter();\n                        DotName notBodyTargetType = baseUrlMethodParam.type().name();\n\n                        ResultHandle methodParam = methodCreator.getMethodParam(baseUrlMethodParam.position());\n                        AssignableResultHandle newUri = methodCreator.createVariable(java.net.URI.class);\n                        BytecodeCreator methodParamNotNull = methodCreator.ifNotNull(methodParam).trueBranch();\n\n                        if (STRING.equals(notBodyTargetType)) {\n                            methodParamNotNull.assign(newUri, methodParamNotNull.newInstance(URI_CTOR, methodParam));\n                        } else if (ResteasyReactiveDotNames.URL.equals(notBodyTargetType)) {\n                            methodParamNotNull.assign(newUri,\n                                    methodParamNotNull.invokeVirtualMethod(\n                                            MethodDescriptor.ofMethod(java.net.URL.class, \"toURI\", java.net.URI.class),\n                                            methodParam));\n                        } else if (URI.equals(notBodyTargetType)) {\n                            methodParamNotNull.assign(newUri, methodParam);\n                        } else {\n                            throw new IllegalArgumentException(\"Unsupported type '\" + notBodyTargetType + \"' used with '\"\n                                    + NOT_BODY + \"'. Offending method is '\" + jandexMethod.declaringClass().name() + \"#\"\n                                    + jandexMethod.name());\n                        }\n\n                        ResultHandle newInputTarget;\n                        if (observabilityIntegrationNeeded) {\n                            // we need to apply the ClientObservabilityHandler to the inputTarget field without altering it\n                            newInputTarget = methodParamNotNull.invokeVirtualMethod(\n                                    MethodDescriptor.ofMethod(WebTargetImpl.class, \"withNewUri\", WebTargetImpl.class,\n                                            java.net.URI.class, ClientRestHandler.class),\n                                    methodParamNotNull.readInstanceField(inputTargetField, methodParamNotNull.getThis()),\n                                    newUri,\n                                    methodParamNotNull.newInstance(\n                                            MethodDescriptor.ofConstructor(ClientObservabilityHandler.class, String.class),\n                                            methodParamNotNull.load(templatePath(restClientInterface, method))));\n                        } else {\n                            // just read the inputTarget field and call withNewUri on it\n                            newInputTarget = methodParamNotNull.invokeVirtualMethod(","sourceCodeStart":1037,"sourceCodeEnd":1073,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/resteasy-reactive/rest-client-jaxrs/deployment/src/main/java/io/quarkus/jaxrs/client/reactive/deployment/JaxrsClientReactiveProcessor.java#L1037-L1073","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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"],"exampleFix":"// before\nString get(@BaseUrl Path base);\n// after\nString get(@BaseUrl java.net.URI base);","handlingStrategy":"type-guard","validationCode":"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); } }","typeGuard":"boolean isUrlType(Class<?> t) { return t == String.class || t == java.net.URL.class || t == java.net.URI.class; }","tryCatchPattern":"try { client.get(); } catch (IllegalArgumentException e) { if (e.getMessage().contains(\"Unsupported type\")) { log.error(\"Convert @BaseUrl parameter to String/URL/URI\"); } throw e; }","preventionTips":["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"],"tags":["quarkus","rest-client","url","unsupported-type","build-time"],"backgroundTag":"unsupported-parameter-type","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}