quarkusio/quarkus · error · InvalidRestClientDefinitionException

Failed to generate client for class " + clazz + " : " + fail

Error message

Failed to generate client for class " + clazz + " : " + failure

What it means

A runtime REST client proxy could not be created for the requested interface because its build-time generation recorded a failure. ClientProxies.get() looks up the generated proxy BiFunction; when absent but a per-class failure message exists, it throws InvalidRestClientDefinitionException carrying that build-time reason (e.g. invalid @Path/@RegisterRestClient configuration or unresolvable annotations).

Source

Thrown at independent-projects/resteasy-reactive/client/runtime/src/main/java/org/jboss/resteasy/reactive/client/impl/ClientProxies.java:31

import org.jboss.resteasy.reactive.client.api.InvalidRestClientDefinitionException;

public class ClientProxies {

    final Map<Class<?>, BiFunction<WebTarget, List<ParamConverterProvider>, ?>> clientProxies;
    private final Map<Class<?>, String> failures;

    public ClientProxies(Map<Class<?>, BiFunction<WebTarget, List<ParamConverterProvider>, ?>> clientProxies,
            Map<Class<?>, String> failures) {
        this.clientProxies = clientProxies;
        this.failures = failures;
    }

    public <T> T get(Class<?> clazz, WebTarget webTarget, List<ParamConverterProvider> providers) {
        BiFunction<WebTarget, List<ParamConverterProvider>, ?> function = clientProxies.get(clazz);
        if (function == null) {
            String failure = failures.get(clazz);
            if (failure != null) {
                throw new InvalidRestClientDefinitionException(
                        "Failed to generate client for class " + clazz + " : " + failure);
            } else {
                if (hasRestClientAnnotations(clazz)) {
                    throw new IllegalStateException("REST client interface: " + clazz
                            + " was not indexed at build time. See https://quarkus.io/guides/cdi-reference#bean_discovery for information on how to index the module that contains it.");
                } else {
                    throw new IllegalArgumentException("Not a REST client interface: " + clazz + ". No @Path annotation " +
                            "found on the class or any methods of the interface and no HTTP method annotations " +
                            "(@POST, @PUT, @GET, @HEAD, @DELETE, etc) found on any of the methods");
                }
            }
        }
        //noinspection unchecked
        return (T) function.apply(webTarget, providers);
    }

    private boolean hasRestClientAnnotations(Class<?> clazz) {
        for (Annotation annotation : clazz.getAnnotations()) {

View on GitHub (pinned to e1c734241f)

Solutions

  1. Read the `: <failure>` suffix of the message — it states the exact build-time generation problem
  2. Fix the offending annotation/config on the client interface (Path expressions, HTTP method annotations, parameter types)
  3. Rebuild the application so the client proxy regenerates cleanly
  4. If the interface is not meant to be a REST client, remove the REST client annotations — the failure map only covers annotated interfaces

Example fix

// before (invalid path template)
@Path("/items/{id")
public interface ItemClient { @GET Item get(@PathParam("id") String id); }

// after
@Path("/items/{id}")
public interface ItemClient { @GET Item get(@PathParam("id") String id); }
Defensive patterns

Strategy: try-catch

Try / catch

try {
    MyClient c = QuarkusRestClientBuilder.newBuilder().build(MyClient.class);
} catch (InvalidRestClientDefinitionException e) {
    log.error("Client generation failed: " + e.getMessage(), e); // read the failure suffix
    throw e;
}

Prevention

When it happens

Trigger: Injecting or calling QuarkusRestClientBuilder/ClientProxies.get() for an interface whose proxy generation failed during the build; a @RegisterRestClient interface with invalid annotations or configuration that the build-time processor recorded as failed.

Common situations: Malformed @Path or @RegisterRestClient config keys; unsupported method signatures (missing @Produces/@Consumes, generics the generator cannot handle); the error message's `failure` suffix names the exact build-time cause — read it.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/de85a8e4fc4a01c2. Report an issue: GitHub.