quarkusio/quarkus · error · IllegalStateException

Proxy type HTTP is required

Error message

Proxy type HTTP is required

What it means

ProxyConfiguration.assertHttpType() is a self-check helper that throws IllegalStateException when the configuration's proxy type is not HTTP. It exists so code that only supports HTTP proxies (e.g. java.net.Proxy construction) can fail fast with a clear message.

Source

Thrown at extensions/proxy-registry/runtime/src/main/java/io/quarkus/proxy/ProxyConfiguration.java:50

    /**
     * Proxy connection timeout.
     */
    Optional<Duration> proxyConnectTimeout();

    /**
     * Proxy type.
     */
    ProxyType type();

    /**
     * @return this {@link ProxyConfiguration} if {@link #type()} returns {@link ProxyType#HTTP};
     *         otherwise throws {@link IllegalStateException}
     * @throws IllegalStateException if {@link #type()} does not return {@link ProxyType#HTTP}
     */
    default ProxyConfiguration assertHttpType() {
        if (type() != ProxyType.HTTP) {
            throw new IllegalStateException("Proxy type HTTP is required");
        }
        return this;
    }
}

View on GitHub (pinned to e1c734241f)

Solutions

  1. Set quarkus.proxy."<name>".type=http (or remove type to use the default) in application.properties
  2. Check type() == ProxyType.HTTP before calling assertHttpType() or constructing an HTTP client proxy
  3. Create a separate proxy configuration for SOCKS usage

Example fix

// before
quarkus.proxy.corporate.type=socks
quarkus.proxy.corporate.host=proxy.example.com
// after
quarkus.proxy.corporate.type=http
quarkus.proxy.corporate.host=proxy.example.com
Defensive patterns

Strategy: validation

Validate before calling

ProxyConfiguration cfg = ...;
if (cfg.type() != ProxyType.HTTP) {
    throw new IllegalArgumentException("Expected HTTP proxy but got " + cfg.type());
}

Type guard

static boolean isHttpProxy(ProxyConfiguration cfg) {
    return cfg != null && cfg.type() == ProxyType.HTTP;
}

Try / catch

try {
    cfg.assertHttpType();
} catch (IllegalStateException e) {
    // fall back to direct connection or a different, HTTP-typed config
    cfg = fallbackHttpConfig();
}

Prevention

When it happens

Trigger: Calling assertHttpType() on a ProxyConfiguration built with ProxyType.SOCKS (or any non-HTTP type), typically when configuring an HTTP client that only accepts HTTP proxies.

Common situations: A quarkus.proxy.* config entry with quarkus.proxy."name".type=socks being fed to code expecting an HTTP proxy; shared proxy configuration reused across clients with different type requirements.

Related errors


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