{"record":{"id":"e36208c4f9a1c0db","repo":"prestodb/presto","slug":"error-fetching-version-from-server","errorCode":null,"errorMessage":"Error fetching version from server","messagePattern":"Error fetching version from server","errorType":"exception","errorClass":"SQLException","httpStatus":null,"severity":"critical","filePath":"presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoConnection.java","lineNumber":748,"sourceCode":"    {\n        return ImmutableMap.copyOf(sessionProperties);\n    }\n\n    @VisibleForTesting\n    public Map<String, String> getCustomHeaders()\n    {\n        return ImmutableMap.copyOf(customHeaders);\n    }\n\n    ServerInfo getServerInfo()\n            throws SQLException\n    {\n        if (serverInfo.get() == null) {\n            try {\n                serverInfo.set(queryExecutor.getServerInfo(httpUri));\n            }\n            catch (RuntimeException e) {\n                throw new SQLException(\"Error fetching version from server\", e);\n            }\n        }\n        return serverInfo.get();\n    }\n\n    @VisibleForTesting\n    List<QueryInterceptor> getQueryInterceptorInstances()\n    {\n        return queryInterceptorInstances;\n    }\n\n    boolean shouldStartTransaction()\n    {\n        return !autoCommit.get() && (transactionId.get() == null);\n    }\n\n    String getStartTransactionSql()\n            throws SQLException","sourceCodeStart":730,"sourceCodeEnd":766,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoConnection.java#L730-L766","documentation":"Server info (including the server version) is lazily fetched from the coordinator via queryExecutor.getServerInfo(httpUri) and cached in serverInfo. Any RuntimeException from that HTTP exchange is wrapped and rethrown as SQLException(\"Error fetching version from server\", e). It surfaces from any API that needs server capabilities when the coordinator is unreachable or its response is unusable.","triggerScenarios":"Calling getServerVersion()-style APIs (or anything touching getServerInfo) while the coordinator is down, returns HTTP 5xx, the response fails to parse, or a proxy/TLS problem breaks the /v1/info exchange; also after the underlying executor has been shut down by a closed connection.","commonSituations":"Coordinator behind a misconfigured load balancer; TLS/host mismatch; server restart or upgrade while connections are open; network partition after initial connect.","solutions":["Verify the coordinator is reachable: curl http(s)://<host>:<port>/v1/info and fix networking/TLS/proxy errors","Retry the triggering call with backoff — the fetch is lazy, so the next attempt re-issues getServerInfo and caches on success","Inspect coordinator logs for 5xx or serialization errors on the info endpoint","Confirm the connection is not reused after close/executor shutdown across threads"],"exampleFix":"// before\nString ver = connection.getServerVersion(); // may throw on unreachable coordinator\n// after\ntry {\n    String ver = connection.getServerVersion();\n} catch (SQLException e) {\n    if (\"Error fetching version from server\".equals(e.getMessage())) {\n        // coordinator unreachable: check network, retry with backoff\n    }\n    throw e;\n}","handlingStrategy":"retry","validationCode":"URL url = new URI(coordinatorUri + \"/v1/info\").toURL();\nHttpURLConnection hc = (HttpURLConnection) url.openConnection();\nhc.setConnectTimeout(3000);\nif (hc.getResponseCode() != 200) {\n    throw new IOException(\"coordinator unreachable: \" + hc.getResponseCode());\n}","typeGuard":null,"tryCatchPattern":"try {\n    String ver = connection.getServerVersion();\n} catch (SQLException e) {\n    if (\"Error fetching version from server\".equals(e.getMessage()) && attempt < 3) {\n        // exponential backoff, then retry — lazy fetch re-runs on next call\n    } else {\n        throw e;\n    }\n}","preventionTips":["Health-check /v1/info on the coordinator before opening heavy workloads","Add retry with backoff around version-dependent calls","Keep TLS/proxy config correct for the coordinator host","Avoid reusing connections after close across threads"],"tags":["jdbc","presto","network","server-info"],"backgroundTag":"server-info-fetch-failed","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"}