prestodb/presto · error · PageTransportErrorException

Expected %s response from server but got %s

Error message

Expected %s response from server but got %s

What it means

The shuffle response's Content-Type did not match the expected application/x-presto-pages type. This typically happens when the worker returned an error page (HTML/text) instead of pages; the expected type and actual content type are reported.

Source

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

                    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));
                }

                String taskInstanceId = getTaskInstanceId(request, response);
                long token = getToken(request, response);
                long nextToken = getNextToken(request, response);
                boolean complete = getComplete(request, response);

                try (SliceInput input = new InputStreamSliceInput(response.getInputStream())) {
                    List<SerializedPage> pages = ImmutableList.copyOf(readSerializedPages(input));
                    return createPagesResponse(taskInstanceId, token, nextToken, pages, complete);
                }
                catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            catch (PageTransportErrorException e) {

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Check worker logs for the underlying failure that produced the non-page response
  2. Verify no proxy or load balancer is rewriting responses between workers
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at presto-main/src/main/java/com/facebook/presto/operator/HttpRpcShuffleClient.java:180 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/3fb9978f71c3611e. Report an issue: GitHub.