prestodb/presto · error · IllegalArgumentException
Invalid header name: %s
Error message
Invalid header name: %s
What it means
AsyncPageTransportServlet.parseURI rejects a request header whose name fails HTTP header-name validation while forwarding extra headers into the page response; the offending name is included and the request is answered with 400 Bad Request.
Source
Thrown at presto-main/src/main/java/com/facebook/presto/server/AsyncPageTransportServlet.java:137
response.sendError(SC_BAD_REQUEST, message);
}
protected void parseURI(String requestURI, HttpServletRequest request, HttpServletResponse response)
throws IOException
{
// Split a task URI without allocating a list and unnecessary strings
// Example: /v1/task/async/{taskId}/results/{bufferId}/{token}
TaskId taskId = null;
OutputBufferId bufferId = null;
long token = 0;
if (request != null) {
Enumeration<String> headerNames = request.getHeaderNames();
while (headerNames.hasMoreElements()) {
String headerName = headerNames.nextElement();
String headerValue = request.getHeader(headerName);
if (headerName.contains("\r") || headerName.contains("\n")) {
throw new IllegalArgumentException(format("Invalid header name: %s", headerName));
}
if (headerValue.contains("\r") || headerValue.contains("\n")) {
throw new IllegalArgumentException(format("Invalid header value: %s", headerValue));
}
}
}
int previousIndex = -1;
for (int part = 0; part < 8; part++) {
int nextIndex = requestURI.indexOf('/', previousIndex + 1);
if (nextIndex == -1 && part != 7 || nextIndex != -1 && part == 7) {
reportFailure(response, format("Unexpected URI for task result request in async mode: %s", requestURI));
return;
}
switch (part) {
case 4:View on GitHub (pinned to 55bb57d202)
Solutions
- Fix the client/proxy that injects the malformed header name
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at presto-main/src/main/java/com/facebook/presto/server/AsyncPageTransportServlet.java:137 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/f910accf0d5da317.
Report an issue: GitHub.