quarkusio/quarkus · error · RuntimeException
Got unexpected error ${e.getOriginalMessage()}
Error message
Got unexpected error ${e.getOriginalMessage()} What it means
When exchange() receives a 200 with a non-empty body, it deserializes the JSON with Jackson into the Response type. If the body is not valid Config-Server JSON, the JacksonException is caught and rethrown as RuntimeException('Got unexpected error ' + originalMessage). This indicates the payload shape or encoding is wrong, not the transport.
Source
Thrown at extensions/spring-cloud-config-client/runtime/src/main/java/io/quarkus/spring/cloud/config/client/runtime/VertxSpringCloudConfigGateway.java:229
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() {
this.webClient.close();
this.vertx.closeAndAwait();
}
}
View on GitHub (pinned to e1c734241f)
Solutions
- Curl the URL and confirm the body is Config Server JSON ({"name":..., "propertySources":[...]})
- Fix authentication so the server returns JSON instead of an HTML login/error page
- Bypass or fix the proxy that alters the response; ensure content-type application/json
Example fix
// before # proxy returns HTML error page with 200 quarkus.spring-cloud-config.url=http://gw.internal/config // after quarkus.spring-cloud-config.url=http://config-server:8888
Defensive patterns
Strategy: try-catch
Validate before calling
String body = httpClient.get(configUrl + "/app/profile").body();
if (!body.trim().startsWith("{")) throw new IllegalStateException("Non-JSON payload: " + body); Try / catch
catch (RuntimeException e) {
if (e.getMessage().startsWith("Got unexpected error")) {
log.error("Config Server returned non-JSON payload; check auth/proxy", e);
}
} Prevention
- Ensure authentication so the server returns JSON, not HTML login pages
- Check Content-Type is application/json
- Inspect gateway/proxy transformations of the response
When it happens
Trigger: Server (or an intermediary) returning HTML (login page, error page) instead of JSON; character-encoding corruption; a proxy rewriting the response; wrong endpoint returning a different JSON schema.
Common situations: Basic-auth redirects to an HTML login form with 200; API gateways returning their own JSON error format; TLS-terminating proxies injecting error pages.
Related errors
- Got unexpected HTTP response code ${r.statusCode()} from ${r
- Got empty HTTP response body ${requestURI.completeURLString(
- 'quarkus-narayana-lra' can only work if 'quarkus-rest-jackso
- Type {fieldType} should be handled by the switch
- Type {type} should be handled by the switch
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/80dee6e6c8478058.
Report an issue: GitHub.