prestodb/presto · error · IllegalArgumentException
Unsupported format for resource estimate '%s': %s
Error message
Unsupported format for resource estimate '%s': %s
What it means
Thrown by parseResourceEstimate when the value of a resource estimate entry cannot be parsed into its expected type (DataSize or Duration) — the original IllegalArgumentException from valueOf is wrapped with the offending key/value. It means the header name was valid but the value format was not.
Source
Thrown at presto-plan-checker-router-plugin/src/main/java/com/facebook/presto/router/scheduler/HttpRequestSessionContext.java:207
switch (name.toUpperCase()) {
case ResourceEstimates.EXECUTION_TIME:
builder.setExecutionTime(Duration.valueOf(value));
break;
case ResourceEstimates.CPU_TIME:
builder.setCpuTime(Duration.valueOf(value));
break;
case ResourceEstimates.PEAK_MEMORY:
builder.setPeakMemory(DataSize.valueOf(value));
break;
case ResourceEstimates.PEAK_TASK_MEMORY:
builder.setPeakTaskMemory(DataSize.valueOf(value));
break;
default:
throw new IllegalStateException(format("Unsupported resource name %s", name));
}
}
catch (IllegalArgumentException e) {
throw new IllegalArgumentException(format("Unsupported format for resource estimate '%s': %s", value, e));
}
}
return builder.build();
}
public String getHeader(String header)
{
return headerMap.getOrDefault(header.toLowerCase(ROOT), emptyList())
.stream()
.findFirst()
.orElse(null);
}
public Identity getIdentity()
{
return identity;
}
View on GitHub (pinned to 55bb57d202)
Solutions
- Fix the value to a valid DataSize (e.g. 1GB) or Duration (e.g. 10m) format as defined by the airlift DataSize/Duration parsers
- Quote the value in client/job configuration so spaces or shell characters do not corrupt it
- Log the full wrapped message which includes the underlying parse error to pinpoint the bad token
Example fix
// before X-Presto-Resource-Estimates: peak_memory=1 GB // after X-Presto-Resource-Estimates: peak_memory=1GB
Defensive patterns
Strategy: validation
Validate before calling
for (String entry : header.split(",")) {
String value = entry.substring(entry.indexOf('=') + 1);
try { DataSize.valueOf(value.replaceFirst("^[a-z_]+=", "")); }
catch (IllegalArgumentException e) { throw new IllegalArgumentException("Bad estimate value: " + value); }
} Try / catch
try { parseResourceEstimate(value); }
catch (IllegalArgumentException e) { log.error("Unparseable resource estimate: {}", e.getMessage()); return Response.status(400).build(); } Prevention
- Use strict airlift DataSize/Duration syntax (no spaces): 1GB, 10m
- Quote values in shell/config files
- Add unit tests that round-trip every configured estimate through valueOf
When it happens
Trigger: X-Presto-Resource-Estimates entries like 'peak_memory=1TBX', 'execution_time=ten minutes', or any value DataSize.valueOf/Duration.valueOf rejects; the catch (IllegalArgumentException) rethrows with this message.
Common situations: Users writing human-friendly units ('1 GB', '10 min') where strict DataSize/Duration syntax is required, missing unit suffixes, locale-dependent formats in job configs.
Related errors
- Unsupported resource name %s
- format(format, args)
- e.getMessage()
- NOT_SUPPORTED
- /userinfo response missing principal field %s
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/2d95c0afd6e95909.
Report an issue: GitHub.