{"record":{"id":"7610284563a663f5","repo":"quarkusio/quarkus","slug":"method-declaringclass-methodname-has-an-unsu","errorCode":null,"errorMessage":"Method ${declaringClass}#${methodName} has an unsupported return type for ${annotationName}. Only String and String[] return types are supported","messagePattern":"Method (.+?)#(.+?) has an unsupported return type for (.+?)\\. Only String and String\\[\\] return types are supported","errorType":"exception","errorClass":"RestClientDefinitionException","httpStatus":null,"severity":"error","filePath":"extensions/resteasy-reactive/rest-client/deployment/src/main/java/io/quarkus/rest/client/reactive/deployment/MicroProfileRestClientEnricher.java","lineNumber":474,"sourceCode":"                            methodCallCreator.load(paramName));\n                } else {\n                    throw new RestClientDefinitionException(\n                            annotationName + \" method \" + declaringClass + \"#\" + methodName\n                                    + \" has too many parameters, at most one parameter, param name, expected\");\n                }\n\n            }\n\n            Type returnType = paramValueMethod.returnType();\n            ResultHandle valuesList;\n            if (isStringArray(returnType)) {\n                // repack array to list\n                valuesList = methodCallCreator.invokeStaticMethod(ARRAYS_AS_LIST, paramValue);\n            } else if (isString(returnType)) {\n                valuesList = methodCallCreator.newInstance(MethodDescriptor.ofConstructor(ArrayList.class));\n                methodCallCreator.invokeInterfaceMethod(LIST_ADD_METHOD, valuesList, paramValue);\n            } else {\n                throw new RestClientDefinitionException(\"Method \" + declaringClass.toString() + \"#\" + methodName\n                        + \" has an unsupported return type for \" + annotationName + \". \" +\n                        \"Only String and String[] return types are supported\");\n            }\n\n            paramAdder.accept(methodCallCreator, valuesList);\n\n            if (!required) {\n                CatchBlockCreator catchBlock = tryBlock.addCatch(Exception.class);\n                ResultHandle log = catchBlock.invokeStaticMethod(\n                        MethodDescriptor.ofMethod(Logger.class, \"getLogger\", Logger.class, String.class),\n                        catchBlock.load(declaringClass.name().toString()));\n                String errorMessage = String.format(\n                        \"Invoking param generation method '%s' for '%s' on method '%s#%s' failed\",\n                        methodName, paramName, declaringClass.name(), declaringMethod.name());\n                catchBlock.invokeVirtualMethod(\n                        MethodDescriptor.ofMethod(Logger.class, \"warn\", void.class, Object.class, Throwable.class),\n                        log,\n                        catchBlock.load(errorMessage), catchBlock.getCaughtException());","sourceCodeStart":456,"sourceCodeEnd":492,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/resteasy-reactive/rest-client/deployment/src/main/java/io/quarkus/rest/client/reactive/deployment/MicroProfileRestClientEnricher.java#L456-L492","documentation":"The method providing a header/query param value must return String or String[]. Any other return type (Integer, List, Optional, etc.) is rejected at build time because the generated code repacks the result into a List of Strings and cannot convert arbitrary types.","triggerScenarios":"@ClientQueryParam valueFrom method returning int, Optional<String>, List<String>, or a custom type; the enricher hits the else branch and throws.","commonSituations":"Developers assume wrapper/collection types are converted automatically, or refactor a method's return type from String after adding caching/Optional.","solutions":["Change the return type to String","Use String[] if multiple values are needed","Convert non-String values inside the method before returning"],"exampleFix":"// before\nstatic List<String> tags() { return List.of(\"a\",\"b\"); }\n// after\nstatic String[] tags() { return new String[]{\"a\",\"b\"}; }","handlingStrategy":"type-guard","validationCode":"boolean validReturnType(Method m) {\n    Class<?> r = m.getReturnType();\n    return r == String.class || r == String[].class;\n}","typeGuard":"static boolean isSupportedValueMethod(Method m) {\n    Class<?> r = m.getReturnType();\n    return r == String.class || r == String[].class;\n}","tryCatchPattern":null,"preventionTips":["Only return String or String[] from value providers","Convert collections inside the method (e.g. String.join)\n","Add a unit test asserting the return type before wiring the annotation"],"tags":["rest-client","build-time","type-mismatch"],"backgroundTag":"rest-client-param-method-return-type-unsupported","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"}