{"record":{"id":"9b4476e8530e6eeb","repo":"prestodb/presto","slug":"expected-response-code-to-be-200-but-was-s-n-s","errorCode":null,"errorMessage":"Expected response code to be 200, but was %s:%n%s","messagePattern":"Expected response code to be 200, but was (.+?):%n(.+?)","errorType":"exception","errorClass":"PageTransportErrorException","httpStatus":null,"severity":"error","filePath":"presto-main/src/main/java/com/facebook/presto/operator/HttpRpcShuffleClient.java","lineNumber":165,"sourceCode":"\n                // otherwise we must have gotten an OK response, everything else is considered fatal\n                if (response.getStatusCode() != HttpStatus.OK.code()) {\n                    StringBuilder body = new StringBuilder();\n                    try (BufferedReader reader = new BufferedReader(new InputStreamReader(response.getInputStream(), UTF_8))) {\n                        // Get up to 1000 lines for debugging\n                        for (int i = 0; i < 1000; i++) {\n                            String line = reader.readLine();\n                            // Don't output more than 100KB\n                            if (line == null || body.length() + line.length() > 100 * 1024) {\n                                break;\n                            }\n                            body.append(line + \"\\n\");\n                        }\n                    }\n                    catch (RuntimeException | IOException e) {\n                        // Ignored. Just return whatever message we were able to decode\n                    }\n                    throw new PageTransportErrorException(\n                            HostAddress.fromUri(request.getUri()),\n                            format(\"Expected response code to be 200, but was %s:%n%s\",\n                                    response.getStatusCode(),\n                                    body.toString()));\n                }\n\n                // invalid content type can happen when an error page is returned, but is unlikely given the above 200\n                String contentType = response.getHeader(CONTENT_TYPE);\n                if (contentType == null) {\n                    throw new PageTransportErrorException(\n                            HostAddress.fromUri(request.getUri()),\n                            format(\"%s header is not set: %s\", CONTENT_TYPE, response));\n                }\n                if (!mediaTypeMatches(contentType, PRESTO_PAGES_TYPE)) {\n                    throw new PageTransportErrorException(\n                            HostAddress.fromUri(request.getUri()),\n                            format(\"Expected %s response from server but got %s\", PRESTO_PAGES_TYPE, contentType));\n                }","sourceCodeStart":147,"sourceCodeEnd":183,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main/src/main/java/com/facebook/presto/operator/HttpRpcShuffleClient.java#L147-L183","documentation":"HttpRpcShuffleClient received a non-200 response while fetching pages from a worker; everything other than OK is fatal for that request. The status code and up to the first 1000 lines of the body are included for diagnosis.","triggerScenarios":"Thrown at presto-main/src/main/java/com/facebook/presto/operator/HttpRpcShuffleClient.java:165 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the returned body for the worker-side failure reason","Check worker health/logs at the URI in question; a crashed or overloaded worker often returns 500","Retry the query once transient worker failures are resolved"],"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"}