quarkusio/quarkus · error · RuntimeException

Got unexpected HTTP response code ${r.statusCode()} from ${r

Error message

Got unexpected HTTP response code ${r.statusCode()} from ${requestURI.completeURLString()}

What it means

VertxSpringCloudConfigGateway.exchange() performs the HTTP call to the Config Server with Vert.x and requires HTTP 200. Any other status code (404 unknown app/profile, 401 bad credentials, 500 server error, connection-level failures surfaced by Vert.x) is converted into a RuntimeException embedding both the status code and the full request URL.

Source

Thrown at extensions/spring-cloud-config-client/runtime/src/main/java/io/quarkus/spring/cloud/config/client/runtime/VertxSpringCloudConfigGateway.java:218

    @Override
    public Uni<Response> exchange(String applicationName, String profile) {
        final ConfigServerUrl requestURI = toConfigServerUrl(applicationName, profile);
        HttpRequest<Buffer> request = webClient
                .get(requestURI.port(), requestURI.host(), requestURI.completeURLString())
                .ssl(UrlUtility.isHttps(requestURI.baseURI()))
                .putHeader("Accept", "application/json");
        if (config.usernameAndPasswordSet()) {
            request.basicAuthentication(config.username().get(), config.password().get());
        }
        for (Map.Entry<String, String> entry : config.headers().entrySet()) {
            request.putHeader(entry.getKey(), entry.getValue());
        }
        log.debug("Attempting to read configuration from '" + requestURI.completeURLString() + "'.");
        return request.send().map(r -> {
            log.debug("Received HTTP response code '" + r.statusCode() + "'");
            if (r.statusCode() != 200) {
                throw new RuntimeException("Got unexpected HTTP response code " + r.statusCode()
                        + " from " + requestURI.completeURLString());
            } else {
                String bodyAsString = r.bodyAsString();
                if (bodyAsString.isEmpty()) {
                    throw new RuntimeException("Got empty HTTP response body " + requestURI.completeURLString());
                }
                try {
                    log.debug("Attempting to deserialize response");
                    return OBJECT_MAPPER.readValue(bodyAsString, Response.class);
                } catch (JacksonException e) {
                    throw new RuntimeException("Got unexpected error " + e.getOriginalMessage());
                }
            }
        });
    }

    @Override
    public void close() {

View on GitHub (pinned to e1c734241f)

Solutions

  1. Run curl -u user:pass <config-url>/<app>/<profile> against the server to reproduce and see the real status/body
  2. Fix the application name, profile, and label so the server locates the config
  3. Provide correct quarkus.spring-cloud-config.username/password if the server is secured
  4. Check server logs for the 5xx cause if the status is 500

Example fix

// before
quarkus.spring-cloud-config.url=http://config-server:8888
# secured server, no credentials -> 401

// after
quarkus.spring-cloud-config.url=http://config-server:8888
quarkus.spring-cloud-config.username=user
quarkus.spring-cloud-config.password=secret
Defensive patterns

Strategy: retry

Validate before calling

// preflight
curl -sS -o /dev/null -w "%{http_code}" -u user:pass "$CONFIG_URL/app/profile"

Try / catch

catch (RuntimeException e) {
    if (e.getMessage().contains("Got unexpected HTTP response code")) {
        // parse status; retry on 5xx with backoff, fail fast on 4xx
    }
}

Prevention

When it happens

Trigger: Config Server returns 404 because the application name or profile has no configuration; 401/403 when credentials (quarkus.spring-cloud-config.username/password) are wrong or missing; 5xx when the server fails; a proxy returning an unexpected status.

Common situations: Typo in quarkus.application.name vs Config Server repository layout; label/branch missing on the server; firewall or gateway intercepting the request.

Related errors


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