quarkusio/quarkus · error · RuntimeException

Invalid proxy setting. The port is not a number in '${proxy}

Error message

Invalid proxy setting. The port is not a number in '${proxy}'

What it means

After finding the last ':' in the proxy string, parseAddress parses the remainder as an integer port. If that substring is not numeric, the NumberFormatException is wrapped in this RuntimeException. It means the proxy host part parsed fine but the port segment is not a number.

Source

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

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) {
            this.host = host;
            this.port = port;
        }

        public String host() {
            return host;
        }

View on GitHub (pinned to e1c734241f)

Solutions

  1. Correct the port to a numeric value, e.g. proxy:8080
  2. Strip scheme/credentials if a full URL was pasted, keeping only host:port
  3. For IPv6, wrap the host in brackets first (e.g. [2001:db8::1]:8080) only if supported, otherwise use a hostname

Example fix

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

Strategy: validation

Validate before calling

static boolean hasNumericPort(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; }
}

Type guard

static boolean isParsablePort(String seg) {
    try { int p = Integer.parseInt(seg); return p > 0 && p <= 65535; } catch (NumberFormatException e) { return false; }
}

Try / catch

try {
    ProxyAddressUtil.parseAddress(proxy);
} catch (RuntimeException e) {
    if (e.getCause() instanceof NumberFormatException) {
        throw new IllegalArgumentException("Proxy port segment is not numeric: " + proxy, e);
    }
    throw e;
}

Prevention

When it happens

Trigger: Passing a proxy string whose port segment is non-numeric or contains extra characters, e.g. "proxy:8080x", "proxy:http", or an IPv6 string where the last colon splits on the wrong segment.

Common situations: Typo in the port in application.properties; pasting a full proxy URL with scheme/credentials (http://user:pass@proxy:8080) into a host:port property; using raw IPv6 addresses (2001:db8::1) which the host:port format does not support.

Related errors


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