OpenFeign/feign · error · UnsupportedOperationException

Invocation Handler Factory overrides are not supported.

Error message

Invocation Handler Factory overrides are not supported.

What it means

ReactorFeign.Builder installs its own ReactorInvocationHandlerFactory (bound to the configured Scheduler) to return Flux/Mono from proxy calls. Overriding the invocation handler factory would break the reactive dispatch, so the override method throws UnsupportedOperationException unconditionally.

Solutions

  1. Remove the invocationHandlerFactory(...) call from the ReactorFeign builder chain
  2. Wrap cross-cutting concerns in the Decoder/Encoder/Client or in operators on the returned Flux/Mono instead
  3. Use classic Feign.builder() if a custom InvocationHandlerFactory is a hard requirement

Example fix

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

Strategy: type-guard

Type guard

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

Prevention

When it happens

Trigger: Calling ReactorFeign.builder().invocationHandlerFactory(customFactory) while building a reactive target.

Common situations: Copying builder chains from classic Feign code that adds metrics/retry via InvocationHandlerFactory; shared builder-configuration utilities applied to reactive builders.

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/b8b8b325b8a7d1ea. Report an issue: GitHub.

Appendix: source

Thrown at reactive/src/main/java/feign/reactive/ReactorFeign.java:53

  }

  public static class Builder extends ReactiveFeign.Builder {

    private final Scheduler scheduler;

    Builder(Scheduler scheduler) {
      this.scheduler = scheduler;
    }

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

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

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

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

    @Override
    public InvocationHandler create(Target target, Map<Method, MethodHandler> dispatch) {
      return new ReactorInvocationHandler(target, dispatch, scheduler);
    }
  }
}

View on GitHub (pinned to e2a1e27560)