prestodb/presto · error · PageTransportErrorException

Expected response code to be 200, but was %s:%n%s

Error message

Expected response code to be 200, but was %s:%n%s

What it means

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.

Source

Thrown at presto-main/src/main/java/com/facebook/presto/operator/HttpRpcShuffleClient.java:165

                // otherwise we must have gotten an OK response, everything else is considered fatal
                if (response.getStatusCode() != HttpStatus.OK.code()) {
                    StringBuilder body = new StringBuilder();
                    try (BufferedReader reader = new BufferedReader(new InputStreamReader(response.getInputStream(), UTF_8))) {
                        // Get up to 1000 lines for debugging
                        for (int i = 0; i < 1000; i++) {
                            String line = reader.readLine();
                            // Don't output more than 100KB
                            if (line == null || body.length() + line.length() > 100 * 1024) {
                                break;
                            }
                            body.append(line + "\n");
                        }
                    }
                    catch (RuntimeException | IOException e) {
                        // Ignored. Just return whatever message we were able to decode
                    }
                    throw new PageTransportErrorException(
                            HostAddress.fromUri(request.getUri()),
                            format("Expected response code to be 200, but was %s:%n%s",
                                    response.getStatusCode(),
                                    body.toString()));
                }

                // invalid content type can happen when an error page is returned, but is unlikely given the above 200
                String contentType = response.getHeader(CONTENT_TYPE);
                if (contentType == null) {
                    throw new PageTransportErrorException(
                            HostAddress.fromUri(request.getUri()),
                            format("%s header is not set: %s", CONTENT_TYPE, response));
                }
                if (!mediaTypeMatches(contentType, PRESTO_PAGES_TYPE)) {
                    throw new PageTransportErrorException(
                            HostAddress.fromUri(request.getUri()),
                            format("Expected %s response from server but got %s", PRESTO_PAGES_TYPE, contentType));
                }

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Inspect the returned body for the worker-side failure reason
  2. Check worker health/logs at the URI in question; a crashed or overloaded worker often returns 500
  3. Retry the query once transient worker failures are resolved
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at presto-main/src/main/java/com/facebook/presto/operator/HttpRpcShuffleClient.java:165 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/9b4476e8530e6eeb. Report an issue: GitHub.