quarkusio/quarkus · error · IllegalStateException

REST client interface: " + clazz + " was not indexed at buil

Error message

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.

What it means

The class looks like a REST client (it carries jakarta.ws.rs or MicroProfile REST client annotations) but no proxy was generated for it because it was not part of the Jandex index at build time. ClientProxies.get() performs this annotation check at runtime when the proxy is missing and directs the developer to Quarkus bean-discovery/indexing docs.

Source

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

    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()) {
            if (isRestClientAnnotation(annotation)) {
                return true;
            }
        }

View on GitHub (pinned to e1c734241f)

Solutions

  1. Add a Jandex index to the library containing the interface (jandex-maven-plugin `jandex` goal, or an empty META-INF/beans.xml)
  2. Register the external dependency for indexing: quarkus.index-dependency.<name>.group-id/artifact-id properties
  3. Ensure the interface is in a module included in the application build, then rebuild
  4. As a last resort use QuarkusRestClientBuilder manually — but indexing is the correct fix

Example fix

// before (unindexed lib) — no action
// after (pom.xml of the library or app)
<plugin>
  <groupId>io.smallrye</groupId>
  <artifactId>jandex-maven-plugin</artifactId>
  <executions><execution><goals><goal>jandex</goal></goals></execution></executions>
</plugin>
// or application.properties:
// quarkus.index-dependency.my-api.group-id=com.example
// quarkus.index-dependency.my-api.artifact-id=my-api
Defensive patterns

Strategy: validation

Validate before calling

// fail fast at startup if the interface wasn't indexed
QuarkusRestClientBuilder.newBuilder().build(MyClient.class); // throws here, not at first call

Try / catch

try {
    MyClient c = QuarkusRestClientBuilder.newBuilder().build(MyClient.class);
} catch (IllegalStateException e) {
    if (e.getMessage().contains("was not indexed at build time")) {
        throw new IllegalStateException("Add jandex-maven-plugin or quarkus.index-dependency.* for " + MyClient.class, e);
    }
    throw e;
}

Prevention

When it happens

Trigger: Calling ClientProxies.get()/QuarkusRestClientBuilder for an interface annotated with @Path, @RegisterRestClient, etc. that lives in a dependency JAR or module not indexed by Jandex at build time.

Common situations: REST client interfaces in external library JARs without a Jandex index (no beans.xml/index file, or not added via quarkus.index-dependency.*); multi-module projects where the API module isn't indexed; dev-mode hot changes adding a new client interface without re-indexing.

Related errors


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