{"record":{"id":"5f47f45752d7ff2e","repo":"prestodb/presto","slug":"failed-to-resolve-host","errorCode":null,"errorMessage":"Failed to resolve host: ","messagePattern":"Failed to resolve host: ","errorType":"exception","errorClass":"ClientException","httpStatus":null,"severity":"error","filePath":"presto-client/src/main/java/com/facebook/presto/client/SpnegoHandler.java","lineNumber":266,"sourceCode":"\n    private static String canonicalizeServiceHostName(String hostName)\n    {\n        try {\n            InetAddress address = InetAddress.getByName(hostName);\n            String fullHostName;\n            if (\"localhost\".equalsIgnoreCase(address.getHostName())) {\n                fullHostName = InetAddress.getLocalHost().getCanonicalHostName();\n            }\n            else {\n                fullHostName = address.getCanonicalHostName();\n            }\n            if (fullHostName.equalsIgnoreCase(\"localhost\")) {\n                throw new ClientException(\"Fully qualified name of localhost should not resolve to 'localhost'. System configuration error?\");\n            }\n            return fullHostName;\n        }\n        catch (UnknownHostException e) {\n            throw new ClientException(\"Failed to resolve host: \" + hostName, e);\n        }\n    }\n\n    private interface GssSupplier<T>\n    {\n        T get()\n                throws GSSException;\n    }\n\n    private static <T> T doAs(Subject subject, GssSupplier<T> action)\n            throws GSSException\n    {\n        try {\n            return Subject.doAs(subject, (PrivilegedExceptionAction<T>) action::get);\n        }\n        catch (PrivilegedActionException e) {\n            Throwable t = e.getCause();\n            throwIfInstanceOf(t, GSSException.class);","sourceCodeStart":248,"sourceCodeEnd":284,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-client/src/main/java/com/facebook/presto/client/SpnegoHandler.java#L248-L284","documentation":"canonicalizeServiceHostName catches UnknownHostException while resolving the service host's IP or canonical name and throws a ClientException 'Failed to resolve host: <host>'. DNS cannot resolve the Presto coordinator host, so a SPNEGO service principal cannot be constructed.","triggerScenarios":"makeServicePrincipal -> canonicalizeServiceHostName with a hostName that InetAddress.getByName/getLocalHost cannot resolve (UnknownHostException).","commonSituations":"Coordinator hostname typo in --server URL; DNS outage; host only in local /etc/hosts but client runs elsewhere; IPv6-only resolution issues; VPN not connected.","solutions":["Verify the server hostname in the connection URL is spelled correctly.","Test resolution: nslookup <host> / getent hosts <host>; add an /etc/hosts entry as an immediate workaround.","Fix DNS server configuration or connect to the network/VPN that can resolve the cluster hosts.","Use the fully qualified domain name instead of a short name."],"exampleFix":"// before\npresto --server https://presto-coordinator:8080  # UnknownHostException\n// after\npresto --server https://presto-coordinator.example.com:8080  # or add host to /etc/hosts","handlingStrategy":"validation","validationCode":"try {\n    InetAddress.getByName(coordinatorHost);\n} catch (UnknownHostException e) {\n    throw new IllegalStateException(\"Cannot resolve coordinator host: \" + coordinatorHost);\n}","typeGuard":null,"tryCatchPattern":"try { ... } catch (ClientException e) { if (e.getMessage().startsWith(\"Failed to resolve host\")) { /* fix DNS or /etc/hosts, then retry */ } throw e; }","preventionTips":["Use FQDNs in connection settings","Verify DNS resolution in deployment health checks","Add cluster hosts to /etc/hosts where DNS is unreliable"],"tags":["dns","network","kerberos"],"backgroundTag":"host-resolution-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"}