{"record":{"id":"2d95c0afd6e95909","repo":"prestodb/presto","slug":"unsupported-format-for-resource-estimate-s-s","errorCode":null,"errorMessage":"Unsupported format for resource estimate '%s': %s","messagePattern":"Unsupported format for resource estimate '(.+?)': (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"presto-plan-checker-router-plugin/src/main/java/com/facebook/presto/router/scheduler/HttpRequestSessionContext.java","lineNumber":207,"sourceCode":"                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()\n    {\n        return identity;\n    }\n","sourceCodeStart":189,"sourceCodeEnd":225,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-plan-checker-router-plugin/src/main/java/com/facebook/presto/router/scheduler/HttpRequestSessionContext.java#L189-L225","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nX-Presto-Resource-Estimates: peak_memory=1 GB\n// after\nX-Presto-Resource-Estimates: peak_memory=1GB","handlingStrategy":"validation","validationCode":"for (String entry : header.split(\",\")) {\n    String value = entry.substring(entry.indexOf('=') + 1);\n    try { DataSize.valueOf(value.replaceFirst(\"^[a-z_]+=\", \"\")); }\n    catch (IllegalArgumentException e) { throw new IllegalArgumentException(\"Bad estimate value: \" + value); }\n}","typeGuard":null,"tryCatchPattern":"try { parseResourceEstimate(value); }\ncatch (IllegalArgumentException e) { log.error(\"Unparseable resource estimate: {}\", e.getMessage()); return Response.status(400).build(); }","preventionTips":["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"],"tags":["http-header","parse-error","presto-router"],"backgroundTag":"invalid-format-parse-error","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"}