quarkusio/quarkus · error · IllegalArgumentException
proxyHost must not be null
Error message
proxyHost must not be null
What it means
RestClientBuilderImpl.proxyAddress(String, int) validates its arguments before storing them. A null host cannot form a proxy address, so the builder throws IllegalArgumentException 'proxyHost must not be null'. The special host value "none" is allowed to disable the proxy.
Source
Thrown at extensions/resteasy-reactive/rest-client/runtime/src/main/java/io/quarkus/rest/client/reactive/runtime/RestClientBuilderImpl.java:229
return this;
}
@Override
public RestClientBuilderImpl hostnameVerifier(HostnameVerifier hostnameVerifier) {
clientBuilder.hostnameVerifier(hostnameVerifier);
return this;
}
@Override
public RestClientBuilderImpl followRedirects(final boolean follow) {
this.followRedirects = follow;
return this;
}
@Override
public RestClientBuilderImpl proxyAddress(final String proxyHost, final int proxyPort) {
if (proxyHost == null) {
throw new IllegalArgumentException("proxyHost must not be null");
}
if ((proxyPort <= 0 || proxyPort > 65535) && !proxyHost.equals("none")) {
throw new IllegalArgumentException("Invalid port number");
}
this.proxyHost = proxyHost;
this.proxyPort = proxyPort;
return this;
}
public RestClientBuilderImpl proxyPassword(String proxyPassword) {
this.proxyPassword = proxyPassword;
return this;
}
public RestClientBuilderImpl proxyUser(String proxyUser) {
this.proxyUser = proxyUser;
return this;View on GitHub (pinned to e1c734241f)
Solutions
- Pass "none" instead of null if you intend to disable the proxy
- Guard the call with a null/empty check and skip proxyAddress when no host is configured
- Fix the config source so the proxy host env var/property is actually populated
Example fix
// before
builder.proxyAddress(System.getenv("PROXY_HOST"), 8080);
// after
String host = System.getenv("PROXY_HOST");
if (host != null) {
builder.proxyAddress(host, 8080);
} Defensive patterns
Strategy: validation
Validate before calling
String host = config.getProxyHost();
if (host != null && !host.isBlank()) {
builder.proxyAddress(host, config.getProxyPort());
} Type guard
static boolean isUsableProxyHost(String h) { return h != null && !h.isBlank(); } Try / catch
try {
builder.proxyAddress(host, port);
} catch (IllegalArgumentException e) {
if (e.getMessage().contains("proxyHost must not be null")) {
log.warn("No proxy host configured; skipping proxy");
} else throw e;
} Prevention
- Null/blank-check proxy host values sourced from env or config before calling proxyAddress
- Use "none" as the documented sentinel to disable proxying
- Fail fast at startup if a proxy is required but its host is unset
When it happens
Trigger: Calling builder.proxyAddress(null, somePort) directly, or programmatically passing a null host variable sourced from an unset environment/config value.
Common situations: Reading proxy host from env/config that is unset and passing it unvalidated; code paths that compute the host conditionally but always call proxyAddress.
Related errors
- Unsupported RestClientProxy method: ${method}
- proxyHost must not be null
- Invalid port number
- Invalid proxy string. Expected <hostname>:<port>, found '${p
- Invalid proxy setting. The port is not a number in '${proxy}
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/75c39d97241f3391.
Report an issue: GitHub.