{"record":{"id":"b9e6e5873b8f165f","repo":"prestodb/presto","slug":"unsupported-resource-name-s","errorCode":null,"errorMessage":"Unsupported resource name %s","messagePattern":"Unsupported resource name (.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"presto-plan-checker-router-plugin/src/main/java/com/facebook/presto/router/scheduler/HttpRequestSessionContext.java","lineNumber":203,"sourceCode":"            String name = nameValue.get(0);\n            String value = nameValue.get(1);\n\n            try {\n                switch (name.toUpperCase()) {\n                    case ResourceEstimates.EXECUTION_TIME:\n                        builder.setExecutionTime(Duration.valueOf(value));\n                        break;\n                    case ResourceEstimates.CPU_TIME:\n                        builder.setCpuTime(Duration.valueOf(value));\n                        break;\n                    case ResourceEstimates.PEAK_MEMORY:\n                        builder.setPeakMemory(DataSize.valueOf(value));\n                        break;\n                    case ResourceEstimates.PEAK_TASK_MEMORY:\n                        builder.setPeakTaskMemory(DataSize.valueOf(value));\n                        break;\n                    default:\n                        throw new IllegalStateException(format(\"Unsupported resource name %s\", name));\n                }\n            }\n            catch (IllegalArgumentException e) {\n                throw new IllegalArgumentException(format(\"Unsupported format for resource estimate '%s': %s\", value, e));\n            }\n        }\n        return builder.build();\n    }\n\n    public String getHeader(String header)\n    {\n        return headerMap.getOrDefault(header.toLowerCase(ROOT), emptyList())\n                .stream()\n                .findFirst()\n                .orElse(null);\n    }\n\n    public Identity getIdentity()","sourceCodeStart":185,"sourceCodeEnd":221,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-plan-checker-router-plugin/src/main/java/com/facebook/presto/router/scheduler/HttpRequestSessionContext.java#L185-L221","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Change the client to send only supported resource estimate names: execution_time, peak_memory, peak_task_memory","Check the ResourceEstimates class in the running Presto version for the exact accepted names and casing","Remove the unknown property from the header/session configuration and set it as a normal session property instead"],"exampleFix":"// before\nX-Presto-Resource-Estimates: cpu_time=10m\n// after\nX-Presto-Resource-Estimates: execution_time=10m","handlingStrategy":"validation","validationCode":"Set<String> allowed = Set.of(\"execution_time\",\"peak_memory\",\"peak_task_memory\");\nfor (String entry : resourceEstimatesHeader.split(\",\")) {\n    String name = entry.substring(0, entry.indexOf('=')).trim();\n    if (!allowed.contains(name)) throw new IllegalArgumentException(\"Unsupported resource name: \" + name);\n}","typeGuard":"boolean isSupportedResourceName(String name) {\n    return name.equals(ResourceEstimates.EXECUTION_TIME)\n        || name.equals(ResourceEstimates.PEAK_MEMORY)\n        || name.equals(ResourceEstimates.PEAK_TASK_MEMORY);\n}","tryCatchPattern":"try { ctx = new HttpRequestSessionContext(request, ...); }\ncatch (IllegalStateException e) { log.warn(\"Bad resource estimate header: {}\", e.getMessage()); respond(400); }","preventionTips":["Only send ResourceEstimates constant names in X-Presto-Resource-Estimates","Validate estimate values with DataSize/Duration.valueOf in tests before deploying client configs","Pin client and router to the same Presto version"],"tags":["http-header","session-property","presto-router"],"backgroundTag":"unsupported-session-property","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}