prestodb/presto · error · IllegalStateException

Unsupported resource name %s

Error message

Unsupported resource name %s

What it means

Thrown (as IllegalStateException) by HttpRequestSessionContext.parseResourceEstimate when a resource estimate entry in the X-Presto-Resource-Estimates header uses a key that is not one of the supported ResourceEstimates names (EXECUTION_TIME, PEAK_MEMORY, PEAK_TASK_MEMORY). The router only understands these known estimate kinds and refuses anything else rather than silently ignoring it.

Source

Thrown at presto-plan-checker-router-plugin/src/main/java/com/facebook/presto/router/scheduler/HttpRequestSessionContext.java:203

            String name = nameValue.get(0);
            String value = nameValue.get(1);

            try {
                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()

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Change the client to send only supported resource estimate names: execution_time, peak_memory, peak_task_memory
  2. Check the ResourceEstimates class in the running Presto version for the exact accepted names and casing
  3. Remove the unknown property from the header/session configuration and set it as a normal session property instead

Example fix

// before
X-Presto-Resource-Estimates: cpu_time=10m
// after
X-Presto-Resource-Estimates: execution_time=10m
Defensive patterns

Strategy: validation

Validate before calling

Set<String> allowed = Set.of("execution_time","peak_memory","peak_task_memory");
for (String entry : resourceEstimatesHeader.split(",")) {
    String name = entry.substring(0, entry.indexOf('=')).trim();
    if (!allowed.contains(name)) throw new IllegalArgumentException("Unsupported resource name: " + name);
}

Type guard

boolean isSupportedResourceName(String name) {
    return name.equals(ResourceEstimates.EXECUTION_TIME)
        || name.equals(ResourceEstimates.PEAK_MEMORY)
        || name.equals(ResourceEstimates.PEAK_TASK_MEMORY);
}

Try / catch

try { ctx = new HttpRequestSessionContext(request, ...); }
catch (IllegalStateException e) { log.warn("Bad resource estimate header: {}", e.getMessage()); respond(400); }

Prevention

When it happens

Trigger: An HTTP request to the router carries a resource-estimates header with an unknown name, e.g. 'X-Presto-Resource-Estimates: cpu_time=10m' or a typo like 'peak_mem=1GB'; any name not in the switch over ResourceEstimates constants reaches the default branch and throws.

Common situations: Clients configured with resource estimate keys from a different Presto version (renamed constants), typos in scheduler/user session configuration, custom properties smuggled into the resource-estimates header.

Related errors


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