{"record":{"id":"80dee6e6c8478058","repo":"quarkusio/quarkus","slug":"got-unexpected-error-e-getoriginalmessage","errorCode":null,"errorMessage":"Got unexpected error ${e.getOriginalMessage()}","messagePattern":"Got unexpected error (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"extensions/spring-cloud-config-client/runtime/src/main/java/io/quarkus/spring/cloud/config/client/runtime/VertxSpringCloudConfigGateway.java","lineNumber":229,"sourceCode":"        for (Map.Entry<String, String> entry : config.headers().entrySet()) {\n            request.putHeader(entry.getKey(), entry.getValue());\n        }\n        log.debug(\"Attempting to read configuration from '\" + requestURI.completeURLString() + \"'.\");\n        return request.send().map(r -> {\n            log.debug(\"Received HTTP response code '\" + r.statusCode() + \"'\");\n            if (r.statusCode() != 200) {\n                throw new RuntimeException(\"Got unexpected HTTP response code \" + r.statusCode()\n                        + \" from \" + requestURI.completeURLString());\n            } else {\n                String bodyAsString = r.bodyAsString();\n                if (bodyAsString.isEmpty()) {\n                    throw new RuntimeException(\"Got empty HTTP response body \" + requestURI.completeURLString());\n                }\n                try {\n                    log.debug(\"Attempting to deserialize response\");\n                    return OBJECT_MAPPER.readValue(bodyAsString, Response.class);\n                } catch (JacksonException e) {\n                    throw new RuntimeException(\"Got unexpected error \" + e.getOriginalMessage());\n                }\n            }\n        });\n    }\n\n    @Override\n    public void close() {\n        this.webClient.close();\n        this.vertx.closeAndAwait();\n    }\n}\n","sourceCodeStart":211,"sourceCodeEnd":241,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/spring-cloud-config-client/runtime/src/main/java/io/quarkus/spring/cloud/config/client/runtime/VertxSpringCloudConfigGateway.java#L211-L241","documentation":"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.","triggerScenarios":"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.","commonSituations":"Basic-auth redirects to an HTML login form with 200; API gateways returning their own JSON error format; TLS-terminating proxies injecting error pages.","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"],"exampleFix":"// before\n# proxy returns HTML error page with 200\nquarkus.spring-cloud-config.url=http://gw.internal/config\n\n// after\nquarkus.spring-cloud-config.url=http://config-server:8888","handlingStrategy":"try-catch","validationCode":"String body = httpClient.get(configUrl + \"/app/profile\").body();\nif (!body.trim().startsWith(\"{\")) throw new IllegalStateException(\"Non-JSON payload: \" + body);","typeGuard":null,"tryCatchPattern":"catch (RuntimeException e) {\n    if (e.getMessage().startsWith(\"Got unexpected error\")) {\n        log.error(\"Config Server returned non-JSON payload; check auth/proxy\", e);\n    }\n}","preventionTips":["Ensure authentication so the server returns JSON, not HTML login pages","Check Content-Type is application/json","Inspect gateway/proxy transformations of the response"],"tags":["quarkus","spring-cloud-config","jackson","json-deserialization","http"],"backgroundTag":"json-deserialization-failed","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}