{"record":{"id":"74449bac4e4a1e87","repo":"quarkusio/quarkus","slug":"method-class-method-has-an-unsupported-retur-74449b","errorCode":null,"errorMessage":"Method ${class}#${method} has an unsupported return type for ClientHeaderParam. Only String is supported when using complex expressions","messagePattern":"Method (.+?)#(.+?) has an unsupported return type for ClientHeaderParam\\. Only String is supported when using complex expressions","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":968,"sourceCode":"                                return fillHeader.invokeStaticMethod(COMPUTER_PARAM_CONTEXT_IMPL_GET_METHOD_PARAM,\n                                        requestContext, fillHeader.load(parameterPosition.get()));\n                            }\n                        };\n                    } else {\n                        throw new IllegalStateException(\"Unknown type \" + accessibleType);\n                    }\n\n                    if (nodes.size() == 1) {\n                        if (!isString(valueType) && !isStringArray(\n                                valueType)) {\n                            throw new RestClientDefinitionException(\"Method \" + headerFillingMethod.declaringClass().toString()\n                                    + \"#\" + headerFillingMethod.name()\n                                    + \" has an unsupported return type for ClientHeaderParam. \" +\n                                    \"Only String and String[] return types are supported\");\n                        }\n                    } else {\n                        if (!isString(valueType)) {\n                            throw new RestClientDefinitionException(\"Method \" + headerFillingMethod.declaringClass().toString()\n                                    + \"#\" + headerFillingMethod.name()\n                                    + \" has an unsupported return type for ClientHeaderParam. \" +\n                                    \"Only String is supported when using complex expressions\");\n                        }\n                    }\n\n                    return new HeaderFillerInfo(valueType, n, supplier);\n\n                } else {\n                    throw new IllegalStateException(\"Unknown node type \" + n.getClass().getName());\n                }\n            }).collect(Collectors.toList());\n\n            AssignableResultHandle headerList = fillHeader.createVariable(List.class);\n            fillHeader.assign(headerList, fillHeader.loadNull());\n            if (headerFillerInfos.size() == 1) {\n                HeaderFillerInfo headerFillerInfo = headerFillerInfos.get(0);\n                ResultHandle headerFillerResult = headerFillerInfo.getResultHandleSupplier().get();","sourceCodeStart":950,"sourceCodeEnd":986,"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#L950-L986","documentation":"When the ClientHeaderParam value is a 'complex expression' (a mix of literal text and multiple expressions producing more than one parsed node), the generated bytecode concatenates each node's value with StringBuilder, which only works with String. The referenced method must therefore return String exactly; String[] cannot be appended, so the build fails with RestClientDefinitionException.","triggerScenarios":"@ClientHeaderParam(name=\"X\", value=\"prefix-{token}-v${version}\") where the referenced method(s) resolve to a non-String return type (including String[]). Only multi-node (complex) values trigger this branch.","commonSituations":"Building composite header strings like 'Bearer {jwt}' or 'key:version' where the token-computation method returns String[] (left over from a previous single-expression usage) or a primitive.","solutions":["Change the referenced method's return type to String","If you need multiple values, drop the surrounding literal text and use a single-expression value with String[] return type","Convert the array/collection to a joined String in the method itself (String.join(...))"],"exampleFix":"// before\n@ClientHeaderParam(name=\"Authorization\", value=\"Bearer {getToken}\")\nString[] getToken() { ... }\n\n// after\n@ClientHeaderParam(name=\"Authorization\", value=\"Bearer {getToken}\")\nString getToken() { return String.join(\",\", tokens); }","handlingStrategy":"validation","validationCode":"// Complex (multi-node) expressions require String return\nMethod m = MyClient.class.getDeclaredMethod(\"getToken\");\nboolean complex = annotationValue().contains(\"-\") || annotationValue().contains(\"${\");\nif (complex && m.getReturnType() != String.class) {\n    throw new IllegalStateException(\"Complex ClientHeaderParam expressions require String return: \" + m);\n}","typeGuard":"static boolean stringOnly(Class<?> t) { return t == String.class; }","tryCatchPattern":null,"preventionTips":["Use String[] return only with a single whole-value expression, never inside composite values","Join arrays into a single String when embedding into composite header text","Document the return-type rule on shared header-provider utility methods"],"tags":["quarkus","rest-client","build-time","annotation-validation","clientheaderparam"],"backgroundTag":"unsupported-return-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"}