{"record":{"id":"6152a77dc2ed6e5d","repo":"t8y2/dbx","slug":"failed-to-open-jdbc-connection","errorCode":null,"errorMessage":"Failed to open JDBC connection","messagePattern":"Failed to open JDBC connection","errorType":"exception","errorClass":"SQLException","httpStatus":null,"severity":"error","filePath":"agents/common/src/main/java/com/dbx/agent/JdbcConnectionPoolRegistry.java","lineNumber":1658,"sourceCode":"            if (outcome.completeExceptionally(failure)) {\n                throw failure;\n            }\n            try {\n                return outcome.get();\n            } catch (ExecutionException error) {\n                throwOpenFailure(error.getCause());\n                throw new IllegalStateException(\"unreachable\");\n            }\n        }\n\n        private static void throwOpenFailure(Throwable error) throws Exception {\n            if (error instanceof Error fatal) {\n                throw fatal;\n            }\n            if (error instanceof Exception exception) {\n                throw exception;\n            }\n            throw new SQLException(\"Failed to open JDBC connection\", error);\n        }\n\n        @Override\n        public void close() {\n            executor.shutdownNow();\n        }\n    }\n\n    private static final class PhysicalConnectionBudget {\n        private final int maximum;\n        private final Semaphore permits;\n\n        private PhysicalConnectionBudget(int maximum) {\n            this.maximum = maximum;\n            this.permits = new Semaphore(maximum, true);\n        }\n\n        private void acquire(OperationDeadline deadline) throws SQLException {","sourceCodeStart":1640,"sourceCodeEnd":1676,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/common/src/main/java/com/dbx/agent/JdbcConnectionPoolRegistry.java#L1640-L1676","documentation":"Fallback SQLException thrown by the connection-open path when a checked Throwable that is neither Error nor Exception escapes the open task (impossible for normal Java code, hence the defensive fallback). Real open failures usually surface as the original Exception rethrown directly; this message means an exotic Throwable type was seen.","triggerScenarios":"Throwable subclasses like custom checked-throwable types thrown by a driver/factory inside the connection-open task that bypass the standard Exception rethrow branches.","commonSituations":"Instrumentation or bytecode-enhancement frameworks (agents, APM) injecting non-standard Throwables; highly unusual driver implementations violating Throwable conventions.","solutions":["Inspect getCause() to identify the exotic Throwable and its source","Disable/probe instrumentation agents to see if one is injecting non-standard throwables","Replace or update the offending driver/wrapper","Report to the library maintainers with the full cause chain if it originates internally"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Non-standard Throwables usually come from instrumentation; verify baseline:\ntry (Connection c = rawDataSource.getConnection()) { }\n// if this passes but pooled open fails, probe agents/enhancers","typeGuard":"static boolean isExoticOpenFailure(SQLException e) {\n    return \"Failed to open JDBC connection\".equals(e.getMessage())\n        && e.getCause() != null\n        && !((e.getCause() instanceof IOException) || (e.getCause() instanceof RuntimeException));\n}","tryCatchPattern":"try {\n    conn = pool.checkout();\n} catch (SQLException e) {\n    if (\"Failed to open JDBC connection\".equals(e.getMessage())) {\n        log.error(\"open failed with exotic throwable:\", e.getCause());\n    }\n    throw e;\n}","preventionTips":["Audit JVM agents/APM instrumentation that modify JDBC classes","Pin a known-good driver version; test upgrades in staging","Keep the cause chain logged to identify the exotic Throwable source","Report reproducible internal cases to library maintainers"],"tags":["jdbc","throwable","defensive","connection-open"],"backgroundTag":"jdbc-open-failed","analyzedSha":"c0390bff16418b651f4728520d99adf8ce48829a","analyzedAt":"2026-09-05T23:05:10.900Z","contentChangedAt":"2026-09-05T23:05:10.900Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}