{"record":{"id":"5a27328344f950ed","repo":"quarkusio/quarkus","slug":"unable-to-invoke-resteasyclientbuilder-method-b","errorCode":null,"errorMessage":"Unable to invoke ResteasyClientBuilder method: ${builderMethodName}","messagePattern":"Unable to invoke ResteasyClientBuilder method: (.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"extensions/resteasy-classic/resteasy-client/runtime/src/main/java/io/quarkus/restclient/runtime/QuarkusRestClientBuilder.java","lineNumber":683,"sourceCode":"            if (builderMethod == null) {\n                throw new IllegalArgumentException(\"ResteasyClientBuilder setter method not found: \" + builderMethodName);\n            }\n            Object[] arguments;\n            if (builderMethod.getParameterCount() > 1) {\n                if (value instanceof List) {\n                    arguments = ((List<?>) value).toArray();\n                } else {\n                    throw new IllegalArgumentException(\n                            \"Value must be an instance of List<> for ResteasyClientBuilder setter method: \"\n                                    + builderMethodName);\n                }\n            } else {\n                arguments = new Object[] { value };\n            }\n            try {\n                builderMethod.invoke(builderDelegate, arguments);\n            } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {\n                throw new IllegalStateException(\"Unable to invoke ResteasyClientBuilder method: \" + builderMethodName, e);\n            }\n        }\n        builderDelegate.property(name, value);\n        return this;\n    }\n\n    private Object newInstanceOf(Class<?> clazz) {\n        if (PROVIDER_FACTORY != null) {\n            return PROVIDER_FACTORY.injectedInstance(clazz);\n        }\n        return this.getBuilderDelegate().getProviderFactory().injectedInstance(clazz);\n    }\n\n    @Override\n    public RestClientBuilder register(Class<?> aClass) {\n        register(newInstanceOf(aClass));\n        return this;\n    }","sourceCodeStart":665,"sourceCodeEnd":701,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/resteasy-classic/resteasy-client/runtime/src/main/java/io/quarkus/restclient/runtime/QuarkusRestClientBuilder.java#L665-L701","documentation":"After locating a matching ResteasyClientBuilder method reflectively and building the argument array, the invocation of that method failed. The original reflection exception (IllegalAccessException, IllegalArgumentException, or InvocationTargetException) is attached as the cause. This indicates the method exists and arguments were supplied, but calling it failed at runtime.","triggerScenarios":"Reflective invoke of a resteasy.* mapped builder method throws — e.g. argument types don't match the method signature (IllegalArgumentException), the method itself threw (InvocationTargetException), or access restrictions in native-image/graal reflection metadata.","commonSituations":"Passing wrong-typed values (String where long expected) via .property(); invocation failures wrapped inside InvocationTargetException from the RESTEasy builder; native-image builds missing reflection config for the method.","solutions":["Inspect the getCause() of the IllegalStateException to find the real failure (type mismatch vs. thrown inside the builder)","Ensure the value type matches the method parameter types exactly (use autoboxing-compatible types, e.g. Long/int)","In native mode, verify the ResteasyClientBuilder methods used via resteasy.* properties are registered for reflection","Remove or fix the offending resteasy.* property"],"exampleFix":"// before\nbuilder.property(\"resteasy.connectionTTL\", \"2000\"); // String, method expects long\n// after\nbuilder.property(\"resteasy.connectionTTL\", 2000L);","handlingStrategy":"try-catch","validationCode":"Method m = ResteasyClientBuilder.class.getMethod(methodName, paramTypes);\n// verify value types are assignable to paramTypes before invoking","typeGuard":"static boolean argsMatch(Method m, Object[] args) {\n    Class<?>[] ps = m.getParameterTypes();\n    if (ps.length != args.length) return false;\n    for (int i = 0; i < ps.length; i++) {\n        if (args[i] != null && !ps[i].isInstance(args[i])) return false;\n    }\n    return true;\n}","tryCatchPattern":"try {\n    builder.property(\"resteasy.\" + name, value);\n} catch (IllegalStateException e) {\n    Throwable cause = e.getCause();\n    log.error(\"Builder method invocation failed: \" + cause, cause);\n}","preventionTips":["Ensure value types exactly match method parameter types (Long vs long, enums, etc.)","In native mode, register reflection entries for ResteasyClientBuilder methods you configure","Check cause chains — InvocationTargetException wraps the real failure"],"tags":["restclient","reflection","native-image"],"backgroundTag":"reflective-invocation-failed","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}