t8y2/dbx · error · IllegalStateException
Not connected
Error message
Not connected
What it means
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.
Source
Thrown at agents/common/src/main/java/com/dbx/agent/AbstractJdbcAgent.java:340
final synchronized boolean hasActivePooledLeases() {
return poolRegistry != null && poolIdentity != null && poolRegistry.hasActiveLeases(poolIdentity);
}
final synchronized boolean quarantinePooledConnection() {
pooledConnectionPoisoned = true;
return requestActive && pooledLease != null && pooledLease.quarantine();
}
final void beginPooledRequest() throws Exception {
ConnectParams params;
String identity;
JdbcConnectionPoolRegistry registry;
synchronized (this) {
if (poolRegistry == null) {
return;
}
if (connectParams == null || poolIdentity == null) {
throw new IllegalStateException("Not connected");
}
requestActive = true;
leasePinnedAtRequestStart = pooledLease != null;
if (pooledLease != null) {
connection = pooledLease.connection();
return;
}
params = connectParams;
identity = poolIdentity;
registry = poolRegistry;
}
JdbcConnectionPoolRegistry.Lease borrowed;
try {
borrowed = borrowPooledConnection(registry, identity, params);
} catch (Exception error) {
synchronized (this) {
requestActive = false;View on GitHub (pinned to c0390bff16)
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
Example fix
// before agent.attachConnectionPoolRegistry(registry); agent.dispatchForRuntime(req); // throws: not connected // after agent.attachConnectionPoolRegistry(registry); agent.connect(connectParams); agent.dispatchForRuntime(req);
Defensive patterns
Strategy: validation
Validate before calling
if (agent.getConnection() == null) {
agent.connect(connectParams); // establish session before dispatch
} Type guard
boolean isSessionReady(AbstractJdbcAgent a) {
return a.getConnection() != null;
} Try / catch
try {
agent.dispatchForRuntime(req);
} catch (IllegalStateException e) {
if ("Not connected".equals(e.getMessage())) {
agent.connect(connectParams);
agent.dispatchForRuntime(req);
}
} Prevention
- 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
When it happens
Trigger: dispatchForRuntime calls beginPooledRequest on an agent whose poolRegistry is set but whose connect() was never completed, or whose poolIdentity was never established.
Common situations: Calling dispatch before connect(); connection failed earlier and left the session half-initialized; agent re-created after shutdown without reconnecting.
Related errors
- Not connected
- JDBC pool registry must be attached before connecting
- Not connected
- No manual transaction is active
- JDBC Session was quarantined while waiting for a connection
AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05).
Data as JSON: /api/errors/b1e5aff9200e5db7.
Report an issue: GitHub.