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

  1. Fix the value to a valid DataSize (e.g. 1GB) or Duration (e.g. 10m) format as defined by the airlift DataSize/Duration parsers
  2. Quote the value in client/job configuration so spaces or shell characters do not corrupt it
  3. 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

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


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/2d95c0afd6e95909. Report an issue: GitHub.