prestodb/presto · error · IllegalArgumentException
Invalid header value: %s
Error message
Invalid header value: %s
What it means
parseURI in AsyncPageTransportServlet validates a custom header carrying URI parts; when a header value cannot be parsed (non-numeric token/token fields or malformed content), the servlet rejects it with this IOException.
Source
Thrown at presto-main/src/main/java/com/facebook/presto/server/AsyncPageTransportServlet.java:140
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:
taskId = TaskId.valueOf(requestURI.substring(previousIndex + 1, nextIndex));
break;
case 6:View on GitHub (pinned to 55bb57d202)
Solutions
- Fix the client/proxy that injects the malformed header value (e.g. control characters or non-ASCII bytes)
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at presto-main/src/main/java/com/facebook/presto/server/AsyncPageTransportServlet.java:140 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/09128d3a4f7f5a81.
Report an issue: GitHub.