{"record":{"id":"f049269ba72feee8","repo":"prestodb/presto","slug":"invalid-s-header","errorCode":null,"errorMessage":"Invalid %s header","messagePattern":"Invalid (.+?) header","errorType":"validation","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"presto-plan-checker-router-plugin/src/main/java/com/facebook/presto/router/scheduler/HttpRequestSessionContext.java","lineNumber":456,"sourceCode":"        // parse session properties\n        ImmutableMap.Builder<String, String> systemProperties = ImmutableMap.builder();\n        for (Map.Entry<String, String> entry : parseSessionHeaders(headerMap).entrySet()) {\n            String fullPropertyName = entry.getKey();\n            String propertyValue = entry.getValue();\n            List<String> nameParts = DOT_SPLITTER.splitToList(fullPropertyName);\n            if (nameParts.size() == 1) {\n                String propertyName = nameParts.get(0);\n\n                assertRequest(!propertyName.isEmpty(), \"Invalid %s header\", PRESTO_SESSION);\n\n                // catalog session properties can not be validated until the transaction has stated, so we delay system property validation also\n                systemProperties.put(propertyName, propertyValue);\n            }\n            else if (nameParts.size() == 2) {\n                continue;\n            }\n            else {\n                throw new IllegalStateException(format(\"Invalid %s header\", PRESTO_SESSION));\n            }\n        }\n        return systemProperties.build();\n    }\n\n    private static Map<String, Map<String, String>> parseCatalogSessionProperties(Map<String, List<String>> headerMap)\n    {\n        Map<String, Map<String, String>> catalogSessionProperties = new HashMap<>();\n        for (Map.Entry<String, String> entry : parseSessionHeaders(headerMap).entrySet()) {\n            String fullPropertyName = entry.getKey();\n            String propertyValue = entry.getValue();\n            List<String> nameParts = DOT_SPLITTER.splitToList(fullPropertyName);\n            if (nameParts.size() == 1) {\n                continue;\n            }\n            if (nameParts.size() == 2) {\n                String catalogName = nameParts.get(0);\n                String propertyName = nameParts.get(1);","sourceCodeStart":438,"sourceCodeEnd":474,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-plan-checker-router-plugin/src/main/java/com/facebook/presto/router/scheduler/HttpRequestSessionContext.java#L438-L474","documentation":"parseSessionProperties throws this when an entry of the X-Presto-Session header has neither one nor two '='-separated name parts — i.e. it is not 'property=value' nor 'catalog.property=value'. The router cannot map the entry to a system or catalog session property.","triggerScenarios":"An X-Presto-Session value like 'foo' (no '='), 'a=b=c' (three parts) or an empty fragment between commas reaches the final else branch and throws.","commonSituations":"Hand-edited header values, shell/config escaping stripping or duplicating '=', clients from mismatched versions emitting extra separators, trailing commas producing empty entries.","solutions":["Rewrite the entry as name=value (system property) or catalog.name=value (catalog property)","Check the client configuration that produces the header for stray '=' or ',' characters","Use the official client which formats the header correctly"],"exampleFix":"// before\nX-Presto-Session: query_max_memory\n// after\nX-Presto-Session: query_max_memory=10GB","handlingStrategy":"validation","validationCode":"for (String entry : sessionHeader.split(\",\")) {\n    long eq = entry.chars().filter(c -> c == '=').count();\n    if (eq != 1 && eq != 2) throw new IllegalArgumentException(\"Invalid X-Presto-Session entry: \" + entry);\n}","typeGuard":null,"tryCatchPattern":"try { new HttpRequestSessionContext(request, opts); }\ncatch (IllegalStateException e) { if (e.getMessage().contains(\"Invalid X-Presto-Session header\")) return Response.status(400).build(); throw e; }","preventionTips":["Use key=value or catalog.key=value entries only","Avoid manual header editing; quote '=' carefully in shell configs","Check for trailing commas / empty fragments"],"tags":["http-header","session-property","malformed"],"backgroundTag":"malformed-request-header","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"}