{"record":{"id":"6f5250ab4864e521","repo":"prestodb/presto","slug":"invalid-response-from-openid-metadata-endpoint-ex","errorCode":null,"errorMessage":"Invalid response from OpenID Metadata endpoint. Expected response code to be %s, but was %s","messagePattern":"Invalid response from OpenID Metadata endpoint\\. Expected response code to be (.+?), but was (.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"presto-main/src/main/java/com/facebook/presto/server/security/oauth2/OidcDiscovery.java","lineNumber":103,"sourceCode":"                        .withMaxAttempts(-1)\n                        .withMaxDuration(discoveryTimeout)\n                        .withDelay(Duration.ofSeconds(1))\n                        .abortOn(IllegalStateException.class)\n                        .onFailedAttempt(attempt -> LOG.debug(\"OpenID Connect Metadata read failed: %s\", attempt.getLastFailure())))\n                .get(() -> httpClient.execute(new OIDCProviderConfigurationRequest(issuer), this::parseConfigurationResponse));\n    }\n\n    private OAuth2ServerConfig parseConfigurationResponse(HTTPResponse response)\n            throws ParseException\n    {\n        int statusCode = response.getStatusCode();\n        if (statusCode != OK.code()) {\n            // stop on any client errors other than REQUEST_TIMEOUT and TOO_MANY_REQUESTS\n            if (statusCode < 400 || statusCode >= 500 || statusCode == REQUEST_TIMEOUT.code() || statusCode == TOO_MANY_REQUESTS.code()) {\n                throw new RuntimeException(\"Invalid response from OpenID Metadata endpoint: \" + statusCode);\n            }\n            else {\n                throw new IllegalStateException(format(\"Invalid response from OpenID Metadata endpoint. Expected response code to be %s, but was %s\", OK.code(), statusCode));\n            }\n        }\n        return readConfiguration(response.getContent());\n    }\n\n    private OAuth2ServerConfig readConfiguration(String body)\n            throws ParseException\n    {\n        OIDCProviderMetadata metadata = OIDCProviderMetadata.parse(body);\n        checkMetadataState(issuer.equals(metadata.getIssuer()), \"The value of the \\\"issuer\\\" claim in Metadata document different than the Issuer URL used for the Configuration Request.\");\n        try {\n            JsonNode metadataJson = OBJECT_MAPPER.readTree(body);\n            Optional<String> userinfoEndpoint;\n            if (userinfoEndpointEnabled) {\n                userinfoEndpoint = getOptionalField(\"userinfo_endpoint\", Optional.ofNullable(metadata.getUserInfoEndpointURI()).map(URI::toString), USERINFO_URL, userinfoUrl);\n            }\n            else {\n                userinfoEndpoint = Optional.empty();","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main/src/main/java/com/facebook/presto/server/security/oauth2/OidcDiscovery.java#L85-L121","documentation":"The OpenID metadata endpoint returned a status other than the expected success code; the expected and actual codes are included. Discovery runs under a Failsafe retry policy, so this error is retried until the discovery timeout elapses.","triggerScenarios":"Thrown at presto-main/src/main/java/com/facebook/presto/server/security/oauth2/OidcDiscovery.java:103 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check that the issuer URL is reachable and the OIDC discovery endpoint responds successfully","Wait for transient provider outages to clear; discovery retries for the configured timeout"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}