OpenFeign/feign · error · UnsupportedOperationException

Invocation Handler Factory overrides are not supported.

Error message

Invocation Handler Factory overrides are not supported.

What it means

RxJavaFeign.Builder installs its own RxJavaInvocationHandlerFactory to adapt calls to Observable/Single with the configured Scheduler. Overriding the invocation handler factory would break the reactive dispatch, so the override throws UnsupportedOperationException unconditionally.

Solutions

  1. Remove the invocationHandlerFactory(...) call from the RxJavaFeign builder chain
  2. Implement cross-cutting concerns via RxJava operators (map, doOnNext, subscribeOn) or a custom Client/Decoder
  3. Use classic Feign.builder() if a custom InvocationHandlerFactory is required

Example fix

// before
RxJavaFeign.builder().invocationHandlerFactory(new MyFactory()).target(Api.class, url);
// after
RxJavaFeign.builder().target(Api.class, url);
Defensive patterns

Strategy: type-guard

Type guard

if (builder instanceof feign.reactive.RxJavaFeign.Builder) {
  // invocationHandlerFactory() is not allowed here
}

Prevention

When it happens

Trigger: Calling RxJavaFeign.builder().invocationHandlerFactory(customFactory) while building an RxJava reactive target.

Common situations: Copying builder configuration from plain Feign code; shared builder utilities that add InvocationHandlerFactory wrappers for logging/metrics.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of OpenFeign/feign@e2a1e27560 (2026-09-10). Data as JSON: /api/errors/fb327563aa44e979. Report an issue: GitHub.

Appendix: source

Thrown at reactive/src/main/java/feign/reactive/RxJavaFeign.java:45

public class RxJavaFeign extends ReactiveFeign {

  public static Builder builder() {
    return new Builder();
  }

  public static class Builder extends ReactiveFeign.Builder {

    private Scheduler scheduler = Schedulers.trampoline();

    @Override
    public Feign internalBuild() {
      super.invocationHandlerFactory(new RxJavaInvocationHandlerFactory(scheduler));
      return super.internalBuild();
    }

    @Override
    public Builder invocationHandlerFactory(InvocationHandlerFactory invocationHandlerFactory) {
      throw new UnsupportedOperationException(
          "Invocation Handler Factory overrides are not supported.");
    }

    public Builder scheduleOn(Scheduler scheduler) {
      this.scheduler = scheduler;
      return this;
    }
  }

  private static class RxJavaInvocationHandlerFactory implements InvocationHandlerFactory {
    private final Scheduler scheduler;

    private RxJavaInvocationHandlerFactory(Scheduler scheduler) {
      this.scheduler = scheduler;
    }

    @Override
    public InvocationHandler create(Target target, Map<Method, MethodHandler> dispatch) {

View on GitHub (pinned to e2a1e27560)