{"record":{"id":"5507c7314409b7d2","repo":"prestodb/presto","slug":"e-getmessage-5507c7","errorCode":null,"errorMessage":"e.getMessage()","messagePattern":"e\\.getMessage\\(\\)","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":411,"sourceCode":"                throw new IllegalStateException(format(\"Invalid %s header: %s\", PRESTO_PREPARED_STATEMENT, e.getMessage()));\n            }\n\n            preparedStatements.put(statementName, sqlString);\n        }\n        return preparedStatements.build();\n    }\n\n    private static Optional<TransactionId> parseTransactionId(String transactionId)\n    {\n        transactionId = trimEmptyToNull(transactionId);\n        if (transactionId == null || transactionId.equalsIgnoreCase(\"none\")) {\n            return Optional.empty();\n        }\n        try {\n            return Optional.of(TransactionId.valueOf(transactionId));\n        }\n        catch (Exception e) {\n            throw new IllegalStateException(e.getMessage());\n        }\n    }\n\n    private static Map<SqlFunctionId, SqlInvokedFunction> parseSessionFunctionHeader(Map<String, List<String>> headerMap)\n    {\n        ImmutableMap.Builder<SqlFunctionId, SqlInvokedFunction> sessionFunctions = ImmutableMap.builder();\n        for (String header : splitSessionHeader(headerMap.getOrDefault(PRESTO_SESSION_FUNCTION, emptyList()))) {\n            List<String> nameValue = Splitter.on('=').limit(2).trimResults().splitToList(header);\n            assertRequest(nameValue.size() == 2, \"Invalid %s header\", PRESTO_SESSION_FUNCTION);\n\n            String serializedFunctionSignature;\n            String serializedFunctionDefinition;\n            try {\n                serializedFunctionSignature = urlDecode(nameValue.get(0));\n                serializedFunctionDefinition = urlDecode(nameValue.get(1));\n            }\n            catch (IllegalArgumentException e) {\n                throw new IllegalArgumentException(format(\"Invalid %s header: %s\", PRESTO_SESSION_FUNCTION, e.getMessage()));","sourceCodeStart":393,"sourceCodeEnd":429,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-plan-checker-router-plugin/src/main/java/com/facebook/presto/router/scheduler/HttpRequestSessionContext.java#L393-L429","documentation":"parseTransactionId wraps any exception from TransactionId.valueOf into an IllegalStateException carrying only e.getMessage(). It means the X-Presto-Transaction-Id header value is not a valid encoded transaction id, so the router cannot reconstruct the transaction for session routing.","triggerScenarios":"A request carries X-Presto-Transaction-Id with a corrupted, truncated, or hand-crafted value that TransactionId.valueOf cannot decode (bad base64/UUID structure).","commonSituations":"Copy-pasting a transaction id with whitespace or quotes into a curl test, stale ids from a restarted cluster, proxies mangling long header values.","solutions":["Remove the X-Presto-Transaction-Id header so the router starts a fresh (autocommit) session","Reuse the transaction id exactly as issued by the coordinator's response headers, unmodified","Verify the id was not truncated/mangled by an intermediary; resend the request unmodified from the original client"],"exampleFix":"// before\ncurl -H \"X-Presto-Transaction-Id: 'some id'\" ...\n// after\ncurl -H \"X-Presto-Transaction-Id: 5f0a...full-issued-id...\" ...","handlingStrategy":"validation","validationCode":"boolean looksLikeTransactionId(String v) {\n    return v != null && !v.isBlank() && v.trim().equals(v) && !v.contains(\" \");\n}","typeGuard":null,"tryCatchPattern":"try { routerCall(request); }\ncatch (IllegalStateException e) { log.warn(\"Dropping bad transaction id: {}\", e.getMessage()); request.removeHeader(\"X-Presto-Transaction-Id\"); retryWithoutTransaction(); }","preventionTips":["Echo transaction ids back exactly as issued, unmodified","Omit the header entirely for autocommit queries","Never hand-edit or wrap ids in quotes when testing with curl"],"tags":["http-header","transaction-id","presto-router"],"backgroundTag":"invalid-transaction-id","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"}