{"record":{"id":"49eaabf9b00b238a","repo":"quarkusio/quarkus","slug":"invalid-clientheaderparam-definition-method-para","errorCode":null,"errorMessage":"Invalid @ClientHeaderParam definition, method parameter %s is not of String type. Problematic interface: %s","messagePattern":"Invalid @ClientHeaderParam definition, method parameter (.+?) is not of String type\\. Problematic interface: (.+?)","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":871,"sourceCode":"                                    \"Invalid %s definition, unable to determine class %s. Problematic interface: %s\",\n                                    CLIENT_HEADER_PARAM, className, declaringClass));\n                        }\n                        headerFillingMethod = findMethod(clazz, declaringClass, staticMethodName,\n                                CLIENT_HEADER_PARAM.toString());\n                    } else {\n                        headerFillingMethod = findMethod(declaringClass, declaringClass, accessibleName,\n                                CLIENT_HEADER_PARAM.toString());\n                    }\n\n                    Type valueType = null;\n                    AtomicInteger parameterPosition = new AtomicInteger(-1);\n                    if (headerFillingMethod == null) {\n                        for (MethodParameterInfo parameter : declaringMethod.parameters()) {\n                            if (!accessibleName.equals(parameter.name())) {\n                                continue;\n                            }\n                            if (!isString(parameter.type())) {\n                                throw new RestClientDefinitionException(String.format(\n                                        \"Invalid %s definition, method parameter %s is not of String type. Problematic interface: %s\",\n                                        CLIENT_HEADER_PARAM, accessibleName, declaringClass));\n                            }\n                            accessibleType = AccessibleType.METHOD_PARAMETER;\n                            valueType = parameter.type();\n                            parameterPosition.set(parameter.position());\n                            break;\n                        }\n                        if (valueType == null) {\n                            throw new RestClientDefinitionException(String.format(\n                                    \"Invalid %s definition, unable to determine target method '%s'. Problematic interface: %s\",\n                                    CLIENT_HEADER_PARAM, accessibleName, declaringClass));\n                        }\n                    } else {\n                        valueType = headerFillingMethod.returnType();\n                    }\n\n                    Supplier<ResultHandle> supplier;","sourceCodeStart":853,"sourceCodeEnd":889,"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#L853-L889","documentation":"If the @ClientHeaderParam value is not a static method reference, it is treated as a method-parameter reference (a name matching a parameter of the annotated client method). If a matching parameter is found but its type is not String, the enricher rejects it since header values must be strings.","triggerScenarios":"@ClientHeaderParam(name=\"X\", value=\"{userId}\") on a method whose parameter userId is Integer/UUID/Object rather than String.","commonSituations":"Using numeric or UUID path/body parameters as header sources; developers assume automatic toString conversion.","solutions":["Change the client method parameter type to String","Convert at the call site before invoking the client method","Use a valueFrom static method that formats the value instead"],"exampleFix":"// before\nString get(@PathParam(\"id\") UUID userId);\n// after\nString get(@PathParam(\"id\") String userId);","handlingStrategy":"type-guard","validationCode":"boolean isStringParam(java.lang.reflect.Executable m, String name) {\n    for (java.lang.reflect.Parameter p : m.getParameters())\n        if (p.getName().equals(name)) return p.getType() == String.class;\n    return false;\n}","typeGuard":"static boolean isStringParameter(java.lang.reflect.Method m, String paramName) {\n    return java.util.Arrays.stream(m.getParameters())\n        .anyMatch(p -> p.getName().equals(paramName) && p.getType() == String.class);\n}","tryCatchPattern":null,"preventionTips":["Use String parameters for any value referenced by {placeholder} annotations","Keep annotation placeholders and parameter names in sync","Prefer valueFrom static methods when non-String types must be formatted"],"tags":["rest-client","type-mismatch","microprofile"],"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"}