{"record":{"id":"b1e5aff9200e5db7","repo":"t8y2/dbx","slug":"not-connected","errorCode":null,"errorMessage":"Not connected","messagePattern":"Not connected","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"agents/common/src/main/java/com/dbx/agent/AbstractJdbcAgent.java","lineNumber":340,"sourceCode":"    final synchronized boolean hasActivePooledLeases() {\n        return poolRegistry != null && poolIdentity != null && poolRegistry.hasActiveLeases(poolIdentity);\n    }\n\n    final synchronized boolean quarantinePooledConnection() {\n        pooledConnectionPoisoned = true;\n        return requestActive && pooledLease != null && pooledLease.quarantine();\n    }\n\n    final void beginPooledRequest() throws Exception {\n        ConnectParams params;\n        String identity;\n        JdbcConnectionPoolRegistry registry;\n        synchronized (this) {\n            if (poolRegistry == null) {\n                return;\n            }\n            if (connectParams == null || poolIdentity == null) {\n                throw new IllegalStateException(\"Not connected\");\n            }\n            requestActive = true;\n            leasePinnedAtRequestStart = pooledLease != null;\n            if (pooledLease != null) {\n                connection = pooledLease.connection();\n                return;\n            }\n            params = connectParams;\n            identity = poolIdentity;\n            registry = poolRegistry;\n        }\n\n        JdbcConnectionPoolRegistry.Lease borrowed;\n        try {\n            borrowed = borrowPooledConnection(registry, identity, params);\n        } catch (Exception error) {\n            synchronized (this) {\n                requestActive = false;","sourceCodeStart":322,"sourceCodeEnd":358,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/common/src/main/java/com/dbx/agent/AbstractJdbcAgent.java#L322-L358","documentation":"beginPooledRequest starts a pooled-connection request on the agent session. If the session was never connected (connectParams or poolIdentity missing) the library cannot borrow from a pool and throws 'Not connected'. It is a state precondition failure, not a network error.","triggerScenarios":"dispatchForRuntime calls beginPooledRequest on an agent whose poolRegistry is set but whose connect() was never completed, or whose poolIdentity was never established.","commonSituations":"Calling dispatch before connect(); connection failed earlier and left the session half-initialized; agent re-created after shutdown without reconnecting.","solutions":["Call connect() with valid ConnectParams before issuing requests","Verify poolIdentity was established (pool attached and connection succeeded)","Reconnect the agent session after a disconnect or shutdown","Guard dispatch calls with a connected-state check"],"exampleFix":"// before\nagent.attachConnectionPoolRegistry(registry);\nagent.dispatchForRuntime(req); // throws: not connected\n// after\nagent.attachConnectionPoolRegistry(registry);\nagent.connect(connectParams);\nagent.dispatchForRuntime(req);","handlingStrategy":"validation","validationCode":"if (agent.getConnection() == null) {\n    agent.connect(connectParams); // establish session before dispatch\n}","typeGuard":"boolean isSessionReady(AbstractJdbcAgent a) {\n    return a.getConnection() != null;\n}","tryCatchPattern":"try {\n    agent.dispatchForRuntime(req);\n} catch (IllegalStateException e) {\n    if (\"Not connected\".equals(e.getMessage())) {\n        agent.connect(connectParams);\n        agent.dispatchForRuntime(req);\n    }\n}","preventionTips":["Always call connect() after attaching the registry, before any request","Track session lifecycle state explicitly in your application","Handle reconnect on transient failures rather than leaving half-open sessions","Test the full init→connect→dispatch sequence in CI"],"tags":["jdbc","connection-state","illegal-state"],"backgroundTag":"jdbc-not-connected","analyzedSha":"c0390bff16418b651f4728520d99adf8ce48829a","analyzedAt":"2026-09-05T23:05:10.900Z","contentChangedAt":"2026-09-05T23:05:10.900Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}