quarkusio/quarkus · error · java.lang.IllegalArgumentException

Invalid REST Client URL used: '<uri>'

Error message

Invalid REST Client URL used: '<uri>'

What it means

StorkClientRequestFilter.filter resolves the service name from the host of a stork:// URI and throws this IllegalArgumentException when the URI has the stork scheme but no host, i.e. it is malformed and no service name can be extracted.

Source

Thrown at independent-projects/resteasy-reactive/client/runtime/src/main/java/org/jboss/resteasy/reactive/client/impl/StorkClientRequestFilter.java:48

            stork = Stork.getInstance();

            if (stork == null) {
                throw new IllegalStateException(
                        "Trying to use a StorkClientRequestFilter but the quarkus-smallrye-stork extension is missing, please add the extension.");
            }
        } catch (Exception e) {
            throw new IllegalStateException(
                    "Trying to use a StorkClientRequestFilter but the quarkus-smallrye-stork extension is missing, please add the extension.");
        }
    }

    @Override
    public void filter(ResteasyReactiveClientRequestContext requestContext) {
        URI uri = requestContext.getUri();
        if (uri != null && uri.getScheme() != null && uri.getScheme().startsWith(Stork.STORK)) {
            String serviceName = uri.getHost();
            if (serviceName == null) { // invalid URI
                throw new IllegalArgumentException("Invalid REST Client URL used: '" + uri + "'");
            }

            requestContext.suspend();
            boolean measureTime = shouldMeasureTime(requestContext.getResponseType());
            try {
                stork.getService(serviceName)
                        .selectInstanceAndRecordStart(measureTime)
                        .subscribe()
                        .with(instance -> {
                            boolean isHttps = instance.isSecure() || "storks".equals(uri.getScheme());
                            String scheme = isHttps ? "https" : "http";
                            try {
                                // In the case the service instance does not set the host and/or port
                                String host = instance.getHost() == null ? "localhost" : instance.getHost();
                                int port = instance.getPort();
                                if (instance.getPort() == 0) {
                                    if (isHttps) {
                                        port = 433;

View on GitHub (pinned to e1c734241f)

Solutions

  1. Set the URI to the full form stork://<service-name> with a non-empty host
  2. Log/print requestContext.getUri() to see the parsed URI and fix the authority portion
  3. Validate the configured URI at startup (assert URI.create(uri).getHost() != null for stork scheme)

Example fix

// before
quarkus.rest-client.my-client.uri=stork://
// after
quarkus.rest-client.my-client.uri=stork://my-service
Defensive patterns

Strategy: validation

Validate before calling

URI uri = URI.create(clientUri);
if (uri.getScheme() != null && uri.getScheme().startsWith("stork")
        && uri.getHost() == null) {
    throw new IllegalArgumentException("stork URI must include a service name host, e.g. stork://my-service (got: " + clientUri + ")");
}

Type guard

boolean isValidStorkUri(String uri) {
    URI u = URI.create(uri);
    return u.getScheme() != null && u.getScheme().startsWith("stork") && u.getHost() != null && !u.getHost().isBlank();
}

Try / catch

try {
    webTarget = client.target(clientUri);
    response = webTarget.request().get();
} catch (IllegalArgumentException e) {
    if (e.getMessage().startsWith("Invalid REST Client URL used")) {
        log.error("Fix the stork:// URI to include a service name");
    } else throw e;
}

Prevention

When it happens

Trigger: Configuring a client URI like stork:// (empty host), stork:///service (empty host per URI parsing), a typo such as 'stork:/svc', or building a stork URI programmatically with URI.create where the authority was dropped.

Common situations: Property typos in quarkus.rest-client.<key>.uri; double slashes lost when templating; URI produced by string concatenation where the service name variable was empty.

Related errors


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