quarkusio/quarkus · error · RuntimeException

Injectable beans are not supported in client

Error message

Injectable beans are not supported in client

What it means

ClientEndpointIndexer.scanInjectableBean unconditionally throws: CDI injectable beans (server-side @Inject-driven endpoint classes resolved via CDI) are not supported by the REST Client processor. The client builds proxies at build time from interfaces and cannot scan/resolve injectable bean hierarchies that the server-side indexer supports.

Source

Thrown at independent-projects/resteasy-reactive/client/processor/src/main/java/org/jboss/resteasy/reactive/client/processor/scanning/ClientEndpointIndexer.java:154

            methodParameters[i] = clientBeanParamInfo;

        } else {
            methodParameters[i] = parseClientBeanParam(beanParamClassInfo, index);
        }

        return false;
    }

    private MethodParameter parseClientBeanParam(ClassInfo beanParamClassInfo, IndexView index) {
        List<Item> items = BeanParamParser.parse(beanParamClassInfo, index);
        return new ClientBeanParamInfo(items, beanParamClassInfo.name().toString());
    }

    @Override
    protected InjectableBean scanInjectableBean(ClassInfo currentClassInfo, ClassInfo actualEndpointInfo,
            Map<String, String> existingConverters, AdditionalReaders additionalReaders,
            Map<String, InjectableBean> injectableBeans, boolean hasRuntimeConverters) {
        throw new RuntimeException("Injectable beans are not supported in client");
    }

    @Override
    protected MethodParameter createMethodParameter(ClassInfo currentClassInfo, ClassInfo actualEndpointInfo, boolean encoded,
            Type paramType, ClientIndexedParam parameterResult, String name, String defaultValue, ParameterType type,
            String elementType, boolean single, String signature,
            Set<String> fileFormNames) {
        DeclaredTypes declaredTypes = getDeclaredTypes(paramType, currentClassInfo, actualEndpointInfo);
        String mimePart = getPartMime(parameterResult.getAnns());
        String partFileName = getPartFileName(parameterResult.getAnns());
        String separator = getSeparator(parameterResult.getAnns());
        return new MethodParameter(name,
                elementType, declaredTypes.getDeclaredType(), declaredTypes.getDeclaredUnresolvedType(), signature, type,
                single,
                defaultValue, parameterResult.isObtainedAsCollection(), parameterResult.isOptional(), encoded,
                mimePart, partFileName, separator);
    }

View on GitHub (pinned to e1c734241f)

Solutions

  1. Ensure @RegisterRestClient is applied to an interface, and the client interface does not extend/invoke the server's CDI bean implementation class.
  2. Extract the shared contract into a plain interface used by both the server bean and the client proxy.
  3. Remove any dependency on runtime CDI injection of the client proxy — clients are built from static interface metadata.
  4. If this arises from a framework hook you overrode/extended, do not reuse server indexer subclasses for client processing.
Defensive patterns

Strategy: validation

Validate before calling

// Clients must be interfaces
if (!clientType.isInterface()) {
  throw new IllegalArgumentException("@RegisterRestClient target must be an interface: " + clientType);
}

Prevention

When it happens

Trigger: Building a REST client from a class hierarchy where the endpoint resolution path requires scanning an injectable bean — e.g. referencing a @ApplicationScoped/@RequestScoped bean class in a context meant for client proxy generation, or an interface hierarchy extending one that the indexer treats as an injectable bean.

Common situations: Sharing a base resource class between server and client and letting the client indexer walk into the CDI-backed server class; misconfiguring a client @RegisterRestClient target to point at a bean class rather than an interface.

Related errors


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