{"record":{"id":"ea052a5e239f9b34","repo":"prestodb/presto","slug":"error-setting-up-connection","errorCode":null,"errorMessage":"Error setting up connection","messagePattern":"Error setting up connection","errorType":"exception","errorClass":"SQLException","httpStatus":null,"severity":"error","filePath":"presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoDriverUri.java","lineNumber":333,"sourceCode":"                        .orElse(Duration.ofMinutes(2));\n\n                KnownTokenCache knownTokenCache = EXTERNAL_AUTHENTICATION_TOKEN_CACHE.getValue(properties).get();\n                Optional<RedirectHandler> configuredHandler = EXTERNAL_AUTHENTICATION_REDIRECT_HANDLERS.getValue(properties)\n                        .map(CompositeRedirectHandler::new)\n                        .map(RedirectHandler.class::cast);\n                RedirectHandler redirectHandler = Optional.ofNullable(REDIRECT_HANDLER.get())\n                        .orElseGet(() -> configuredHandler.orElseThrow(() -> new RuntimeException(\"External authentication redirect handler is not configured\")));\n                ExternalAuthenticator authenticator = new ExternalAuthenticator(redirectHandler, poller, knownTokenCache.create(), timeout);\n\n                builder.authenticator(authenticator);\n                builder.addInterceptor(authenticator);\n            }\n        }\n        catch (ClientException e) {\n            throw new SQLException(e.getMessage(), e);\n        }\n        catch (RuntimeException e) {\n            throw new SQLException(\"Error setting up connection\", e);\n        }\n    }\n\n    private static Map<String, String> parseParameters(String query)\n            throws SQLException\n    {\n        Map<String, String> result = new HashMap<>();\n\n        if (query != null) {\n            Iterable<String> queryArgs = QUERY_SPLITTER.split(query);\n            for (String queryArg : queryArgs) {\n                List<String> parts = ARG_SPLITTER.splitToList(queryArg);\n                if (result.put(parts.get(0), parts.get(1)) != null) {\n                    throw new SQLException(format(\"Connection property '%s' is in URL multiple times\", parts.get(0)));\n                }\n            }\n        }\n","sourceCodeStart":315,"sourceCodeEnd":351,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoDriverUri.java#L315-L351","documentation":"A generic wrapper in PrestoDriverUri.setupClient: any unexpected RuntimeException during connection-property processing (kerberos setup, token caches, external-auth redirect handler resolution) is rethrown as SQLException(\"Error setting up connection\", e), acting as a catch-all that must be diagnosed via its cause.","triggerScenarios":"Thrown at presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoDriverUri.java:333 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Read the cause chain to find the real setup failure (missing required property, bad kerberos config, absent redirect handler)","Provide all required connection properties for the chosen authentication mode","Supply a RedirectHandler or set the required external-auth properties when external authentication is enabled"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}