{"record":{"id":"57ce6133826ad8ac","repo":"prestodb/presto","slug":"s-header-is-not-set-s-57ce61","errorCode":null,"errorMessage":"%s header is not set: %s","messagePattern":"(.+?) header is not set: (.+?)","errorType":"exception","errorClass":"PageTransportErrorException","httpStatus":null,"severity":"error","filePath":"presto-spark-base/src/main/java/com/facebook/presto/spark/execution/http/PrestoSparkHttpTaskClient.java","lineNumber":763,"sourceCode":"                                    body.append(line + \"\\n\");\n                                }\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.url().uri()),\n                            format(\"Expected response code to be 200, but was %s:%n%s\",\n                                    response.code(),\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.header(CONTENT_TYPE);\n                if (contentType == null) {\n                    throw new PageTransportErrorException(\n                            HostAddress.fromUri(request.url().uri()),\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.url().uri()),\n                            format(\"Expected %s response from server but got %s\", PRESTO_PAGES_TYPE, contentType));\n                }\n\n                String taskInstanceId = getTaskInstanceId(request, response);\n                long token = getToken(request, response);\n                long nextToken = getNextToken(request, response);\n                boolean complete = getComplete(request, response);\n\n                ResponseBody responseBody = response.body();\n                if (responseBody == null) {\n                    throw new PageTransportErrorException(\n                            HostAddress.fromUri(request.url().uri()),","sourceCodeStart":745,"sourceCodeEnd":781,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-spark-base/src/main/java/com/facebook/presto/spark/execution/http/PrestoSparkHttpTaskClient.java#L745-L781","documentation":"After a successful 200 response, the client validates the Content-Type header; if it is absent, a PageTransportErrorException is thrown. A 200 response without Content-Type is treated as a protocol violation from the task server.","triggerScenarios":"handle() receives a 200 response whose header map contains no CONTENT_TYPE value — contentType == null triggers the throw with the full response in the message.","commonSituations":"Intermediary proxies/CDNs stripping the Content-Type header; a non-Presto service (e.g. a default web server page) answering on the task port; misconfigured reverse proxy rewriting responses.","solutions":["Inspect what actually answered on that host/port — the response printed in the message reveals if a proxy or wrong service replied","Fix the proxy/load balancer to pass through the Content-Type header","Verify the task server port/URI configuration points at the Presto Spark task server","Retry the request; transient proxy misrouting can be intermittent"],"exampleFix":"// validate the endpoint before heavy use\n// curl -i http://<host>:<port>/v2/task/... => must include Content-Type: application/x-presto-pages or similar\n// fix proxy config to preserve headers:\n// before (nginx): proxy_pass http://tasks;\n// after (nginx): proxy_pass http://tasks; proxy_set_header Content-Type $upstream_http_content_type;","handlingStrategy":"try-catch","validationCode":"// probe response headers from the task endpoint\nResponse probe = httpClient.newCall(new Request.Builder().url(taskUri).head().build()).execute();\nif (probe.header(\"Content-Type\") == null) throw new IllegalStateException(\"proxy stripping Content-Type\");","typeGuard":"null","tryCatchPattern":"try {\n    return taskClient.handle(request);\n}\ncatch (PageTransportErrorException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"header is not set\")) {\n        // inspect what service actually answered; check proxy config, then retry\n    }\n    throw e;\n}","preventionTips":["Configure proxies/load balancers to pass through Content-Type untouched","Verify task server URIs point at Presto Spark task servers, not generic web endpoints","Add endpoint health checks validating response headers","Log the full response (included in the exception) to identify the answering service"],"tags":["http","content-type","protocol-violation","page-transport","spark"],"backgroundTag":"missing-content-type-header","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"}