{"record":{"id":"dd6c06244350f021","repo":"quarkusio/quarkus","slug":"got-unexpected-http-response-code-r-statuscode-dd6c06","errorCode":null,"errorMessage":"Got unexpected HTTP response code ${r.statusCode()} from ${requestURI}","messagePattern":"Got unexpected HTTP response code (.+?) from (.+?)","errorType":"http","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"extensions/spring-cloud-config-client/runtime/src/main/java/io/quarkus/spring/cloud/config/client/runtime/eureka/EurekaClient.java","lineNumber":51,"sourceCode":"    public JsonObject fetchInstances(String eurekaUrl, String appId) {\n        String serviceUrl = UrlUtility.sanitize(eurekaUrl);\n        URI serviceURI;\n        try {\n            serviceURI = new URI(serviceUrl);\n        } catch (URISyntaxException e) {\n            throw new IllegalArgumentException(\"Value: '\" + serviceUrl, e);\n        }\n        log.debug(\"Attempting to discover Spring Cloud Config Server URL for service '\" + appId + \"' using URL '\" + eurekaUrl\n                + \"'\");\n        String requestURI = serviceURI.getPath() + \"/apps/\" + appId;\n        log.debug(\"Attempting to read configuration from '\" + requestURI + \"'.\");\n        Uni<JsonObject> uni = webClient\n                .get(UrlUtility.getPort(serviceURI), serviceURI.getHost(), requestURI)\n                .putHeader(\"Accept\", \"application/json\")\n                .send()\n                .map(r -> {\n                    if (r.statusCode() != 200) {\n                        throw new RuntimeException(\n                                \"Got unexpected HTTP response code \" + r.statusCode() + \" from \" + requestURI);\n                    }\n                    String bodyAsString = r.bodyAsString();\n                    log.debug(\"Received response from Spring Cloud Config Server: \"\n                            + new JsonObject(bodyAsString).encodePrettily());\n                    List<JsonObject> upInstances = eurekaResponseMapper.instances(r.bodyAsString())\n                            .stream()\n                            .filter(i -> UP.equals(i.getString(STATUS)))\n                            .toList();\n\n                    return randomEurekaInstanceSelector.select(upInstances);\n                });\n\n        return uni.await().atMost(timeout);\n    }\n\n}\n","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/spring-cloud-config-client/runtime/src/main/java/io/quarkus/spring/cloud/config/client/runtime/eureka/EurekaClient.java#L33-L69","documentation":"After querying Eureka for instances of the Config Server, EurekaClient requires HTTP 200. Any other status (404, 401, 403, 500, 503...) triggers this RuntimeException naming the code and request URI, meaning the instance lookup against Eureka failed.","triggerScenarios":"GET <eureka>/apps/<serviceId> returns non-200: serviceId not registered (404), Eureka requires credentials (401/403), Eureka server error (500/503).","commonSituations":"Wrong service-id (Eureka is case-sensitive for app IDs); Eureka secured with basic auth but no credentials configured; wrong context path so /apps/... 404s; Eureka in read-only/self-preserved mode returning 503.","solutions":["Verify the serviceId exists in Eureka (dashboard shows registered apps; app IDs are uppercase/case-sensitive)","Add Eureka credentials if the registry is secured (configure them in the eureka client config)","Check the requestURI in the message against your Eureka server's actual base path","Check Eureka server logs for 5xx causes and retry after Eureka is healthy"],"exampleFix":"# before\nquarkus.spring-cloud-config.discovery.service-id=my-config\n# after (match Eureka registered app id)\nquarkus.spring-cloud-config.discovery.service-id=SPRING-CLOUD-CONFIG-SERVER","handlingStrategy":"retry","validationCode":"// verify registration first\nHTTP GET {eureka}/eureka/apps/{SERVICE_ID} with Accept: application/json\n// require 200 and at least one instance with status UP","typeGuard":null,"tryCatchPattern":"try {\n    return eurekaClient.fetchInstances(eurekaUrl, appId);\n} catch (RuntimeException e) {\n    if (e.getMessage().contains(\"response code 5\")) retryWithBackoff(3);\n    else throw e; // 404/401 are config problems, not transient\n}","preventionTips":["Confirm the app id in Eureka dashboard (case-sensitive, usually uppercase)","Configure Eureka basic-auth credentials when the registry is secured","Monitor Eureka health (self-preservation/read-only mode)","Keep the Eureka context path in sync with the configured URL"],"tags":["eureka","http","service-discovery","network"],"backgroundTag":"unexpected-http-status","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}