quarkusio/quarkus · error · RuntimeException

Invalid proxy string. Expected <hostname>:<port>, found '${p

Error message

Invalid proxy string. Expected <hostname>:<port>, found '${proxy}'

What it means

ProxyAddressUtil.parseAddress splits a proxy string on the last ':' expecting the format <hostname>:<port>. This error is thrown when there is no colon (or the colon is the first/last character), so no valid host and port can be extracted. The library throws RuntimeException because the proxy address comes from user configuration and is unusable.

Source

Thrown at extensions/resteasy-reactive/rest-client/runtime/src/main/java/io/quarkus/rest/client/reactive/runtime/ProxyAddressUtil.java:9

package io.quarkus.rest.client.reactive.runtime;

public class ProxyAddressUtil {

    public static HostAndPort parseAddress(String proxyString) {
        int lastColonIndex = proxyString.lastIndexOf(':');

        if (lastColonIndex <= 0 || lastColonIndex == proxyString.length() - 1) {
            throw new RuntimeException("Invalid proxy string. Expected <hostname>:<port>, found '" + proxyString + "'");
        }

        String host = proxyString.substring(0, lastColonIndex);
        int port;
        try {
            port = Integer.parseInt(proxyString.substring(lastColonIndex + 1));
        } catch (NumberFormatException e) {
            throw new RuntimeException("Invalid proxy setting. The port is not a number in '" + proxyString + "'", e);
        }
        return new HostAndPort(host, port);
    }

    @SuppressWarnings("ClassCanBeRecord") // don't convert to record because we have code that accesses the public field
    public static class HostAndPort {
        public final String host;
        public final int port;

        public HostAndPort(String host, int port) {

View on GitHub (pinned to e1c734241f)

Solutions

  1. Provide the proxy as host:port, e.g. proxy.corp.com:8080
  2. Remove the trailing colon or add the missing port
  3. Validate the string before assigning it to the config property

Example fix

# before
quarkus.rest-client.svc.proxy-address=proxy.corp.com
# after
quarkus.rest-client.svc.proxy-address=proxy.corp.com:8080
Defensive patterns

Strategy: validation

Validate before calling

static boolean isValidProxyString(String s) {
    if (s == null) return false;
    int i = s.lastIndexOf(':');
    return i > 0 && i < s.length() - 1;
}

Type guard

static boolean isHostPort(String s) {
    int i = s == null ? -1 : s.lastIndexOf(':');
    if (i <= 0 || i == s.length() - 1) return false;
    try { Integer.parseInt(s.substring(i + 1)); return true; } catch (NumberFormatException e) { return false; }
}

Try / catch

try {
    ProxyAddressUtil.parseAddress(proxy);
} catch (RuntimeException e) {
    throw new IllegalArgumentException("Proxy must be host:port, got: " + proxy, e);
}

Prevention

When it happens

Trigger: Calling QuarkusRestClientBuilder.proxyAddress(String, int) alternatives / config properties (quarkus.rest-client.<name>.proxy-address-mapping or proxy-address) with a string lacking a colon, e.g. "localhost", ":8080", or "localhost:".

Common situations: Configured only the host without the port; copied a proxy URL including scheme (http://proxy:8080 handled differently) or trailing colon; env-based proxy value empty or malformed.

Related errors


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