quarkusio/quarkus · error · IllegalStateException

Only one client SendingInterceptor is supported

Error message

Only one client SendingInterceptor is supported

What it means

The builder stores a single Function<String, SendingInterceptor> for client-side sending interceptors. A second registration attempt throws IllegalStateException; composition is intentionally deferred.

Source

Thrown at extensions/websockets-next/runtime/src/main/java/io/quarkus/websockets/next/runtime/telemetry/WebSocketTelemetryProviderBuilder.java:137

    }

    void pathToServerSendingInterceptor(Function<String, SendingInterceptor> pathToServerSendingInterceptor) {
        Objects.requireNonNull(pathToServerSendingInterceptor);
        if (this.pathToServerSendingInterceptor == null) {
            this.pathToServerSendingInterceptor = pathToServerSendingInterceptor;
        } else {
            // we can implement composite if we need this in the future
            throw new IllegalStateException("Only one server SendingInterceptor is supported");
        }
    }

    void pathToClientSendingInterceptor(Function<String, SendingInterceptor> pathToClientSendingInterceptor) {
        Objects.requireNonNull(pathToClientSendingInterceptor);
        if (this.pathToClientSendingInterceptor == null) {
            this.pathToClientSendingInterceptor = pathToClientSendingInterceptor;
        } else {
            // we can implement composite if we need this in the future
            throw new IllegalStateException("Only one client SendingInterceptor is supported");
        }
    }

    WebSocketTelemetryProvider build() {
        return new WebSocketTelemetryProvider(serverEndpointDecorator, clientEndpointDecorator,
                pathToClientConnectionInterceptor, pathToServerConnectionInterceptor, pathToClientSendingInterceptor,
                pathToServerSendingInterceptor, pathToClientErrorInterceptor, pathToServerErrorInterceptor);
    }

}

View on GitHub (pinned to e1c734241f)

Solutions

  1. Register only one client sending interceptor function
  2. Merge logic into one composite Function
  3. Remove the duplicate registration source

Example fix

// before
builder.pathToClientSendingInterceptor(a);
builder.pathToClientSendingInterceptor(b);
// after
builder.pathToClientSendingInterceptor(path -> a.apply(path) == null ? b.apply(path) : a.apply(path));
Defensive patterns

Strategy: validation

Validate before calling

if (builder.pathToClientSendingInterceptor != null) throw new IllegalStateException("already registered");

Try / catch

try { builder.pathToClientSendingInterceptor(fn); } catch (IllegalStateException e) { /* handle duplicate */ }

Prevention

When it happens

Trigger: Calling pathToClientSendingInterceptor(...) when one is already registered on the builder.

Common situations: Two integrations (e.g. tracing and metrics) both wiring client sending interceptors; duplicate recorder invocations at build time.

Related errors


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