OpenFeign/feign · error · UnsupportedOperationException

Method " " should not be called

Error message

Method "%s" should not be called

What it means

Thrown by the FeignInvocationHandler's invoke method when a method marked as ignored in the interface metadata is invoked on the Feign proxy. Feign builds a dispatch table per method; methods annotated to be ignored (e.g. via @FeignIgnore or ignored configuration) have no handler, so calling them on the proxy is a programming/configuration error rather than an HTTP failure. The "equals"/"hashCode"/"toString" Object methods are intercepted separately, so any other method without a dispatch entry reaches this error.

Solutions

  1. Remove the ignore annotation/configuration for the method so Feign generates a real handler for it
  2. Stop calling the ignored method on the Feign proxy; invoke it on a concrete implementation instead
  3. Check the target interface for stale methods left behind after configuration changes
  4. Verify the Contract being used actually processes the method's annotations and produces metadata
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at core/src/main/java/feign/ReflectiveFeign.java:100 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at core/src/main/java/feign/ReflectiveFeign.java:100

      this.dispatch = checkNotNull(dispatch, "dispatch for %s", target);
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
      if ("equals".equals(method.getName())) {
        try {
          Object otherHandler =
              args.length > 0 && args[0] != null ? Proxy.getInvocationHandler(args[0]) : null;
          return equals(otherHandler);
        } catch (IllegalArgumentException e) {
          return false;
        }
      } else if ("hashCode".equals(method.getName())) {
        return hashCode();
      } else if ("toString".equals(method.getName())) {
        return toString();
      } else if (!dispatch.containsKey(method)) {
        throw new UnsupportedOperationException(
            String.format("Method \"%s\" should not be called", method.getName()));
      }

      return dispatch.get(method).invoke(args);
    }

    @Override
    public boolean equals(Object obj) {
      if (obj instanceof FeignInvocationHandler) {
        FeignInvocationHandler other = (FeignInvocationHandler) obj;
        return target.equals(other.target);
      }
      return false;
    }

    @Override
    public int hashCode() {
      return target.hashCode();

View on GitHub (pinned to e2a1e27560)