quarkusio/quarkus · error · IllegalArgumentException

Value: '${serviceUrl}

Error message

Value: '${serviceUrl}

What it means

EurekaClient.fetchInstances() sanitizes the configured Eureka URL and parses it as a URI. This IllegalArgumentException is thrown when the sanitized URL is not a valid URI; the offending value is included in the message (note the message string is left unclosed: "Value: '<url>").

Source

Thrown at extensions/spring-cloud-config-client/runtime/src/main/java/io/quarkus/spring/cloud/config/client/runtime/eureka/EurekaClient.java:39

    private final Duration timeout;
    private final EurekaResponseMapper eurekaResponseMapper;
    private final RandomEurekaInstanceSelector randomEurekaInstanceSelector;

    public EurekaClient(WebClient webClient, Duration timeout, EurekaResponseMapper eurekaResponseMapper,
            RandomEurekaInstanceSelector randomEurekaInstanceSelector) {
        this.webClient = webClient;
        this.timeout = timeout;
        this.eurekaResponseMapper = eurekaResponseMapper;
        this.randomEurekaInstanceSelector = randomEurekaInstanceSelector;
    }

    public JsonObject fetchInstances(String eurekaUrl, String appId) {
        String serviceUrl = UrlUtility.sanitize(eurekaUrl);
        URI serviceURI;
        try {
            serviceURI = new URI(serviceUrl);
        } catch (URISyntaxException e) {
            throw new IllegalArgumentException("Value: '" + serviceUrl, e);
        }
        log.debug("Attempting to discover Spring Cloud Config Server URL for service '" + appId + "' using URL '" + eurekaUrl
                + "'");
        String requestURI = serviceURI.getPath() + "/apps/" + appId;
        log.debug("Attempting to read configuration from '" + requestURI + "'.");
        Uni<JsonObject> uni = webClient
                .get(UrlUtility.getPort(serviceURI), serviceURI.getHost(), requestURI)
                .putHeader("Accept", "application/json")
                .send()
                .map(r -> {
                    if (r.statusCode() != 200) {
                        throw new RuntimeException(
                                "Got unexpected HTTP response code " + r.statusCode() + " from " + requestURI);
                    }
                    String bodyAsString = r.bodyAsString();
                    log.debug("Received response from Spring Cloud Config Server: "
                            + new JsonObject(bodyAsString).encodePrettily());
                    List<JsonObject> upInstances = eurekaResponseMapper.instances(r.bodyAsString())

View on GitHub (pinned to e1c734241f)

Solutions

  1. Fix the service-url to a full valid URI, e.g. http://eureka-host:8761/eureka
  2. Check the sanitized value printed in the message for stray spaces/quotes characters
  3. Ensure scheme and host are present; UrlUtility.sanitize only appends missing trailing slash, it does not add schemes

Example fix

# before
quarkus.spring-cloud-config.discovery.eureka.service-url=localhost:8761/eureka
# after
quarkus.spring-cloud-config.discovery.eureka.service-url=http://localhost:8761/eureka
Defensive patterns

Strategy: validation

Validate before calling

boolean validUrl;
try {
    new URI(UrlUtility.sanitize(serviceUrl));
    validUrl = serviceUrl.startsWith("http://") || serviceUrl.startsWith("https://");
} catch (URISyntaxException e) { validUrl = false; }
// fail fast with a clear message if !validUrl

Try / catch

try {
    eurekaClient.fetchInstances(eurekaUrl, appId);
} catch (IllegalArgumentException e) {
    log.error("Malformed Eureka URL: " + e.getMessage());
}

Prevention

When it happens

Trigger: discover() passes quarkus.spring-cloud-config.discovery.eureka.service-url into fetchInstances; the URL lacks a scheme, contains illegal characters/spaces, or is malformed (e.g. 'localhost:8761/eureka' without http://).

Common situations: Forgot the http:// scheme; trailing spaces or quotes in application.properties; env var substitution produced a malformed URL; IPv6 or special characters not encoded.

Understand the failure class

Background: "Invalid URL" / "URL cannot be empty": fix the malformed or missing URL behind request-construction failures — this error's family across 50 libraries.

Related errors


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