t8y2/dbx · error
Not connected
Error message
Not connected
What it means
activeClient returns the session's lazy HTTP client; if no successful connect has happened yet, the client is nil and this error is thrown. All authenticated operations (user list/add/delete, role grants) route through it, so any call before a successful connect fails with this message.
Source
Thrown at agents/drivers/etcd2-go/client.go:100
s.clientMu.Lock()
s.httpClient = client
s.connectedEndpoints = endpointList
s.serverVersion = client.serverVersion
s.clientMu.Unlock()
return map[string]bool{"ok": true}, nil
}
if lastErr == nil {
lastErr = errors.New("No etcd endpoint configured")
}
return nil, lastErr
}
func (s *etcd2Session) activeClient() (*authenticatedClient, error) {
s.clientMu.Lock()
client := s.httpClient
s.clientMu.Unlock()
if client == nil {
return nil, errors.New("Not connected")
}
return client, nil
}
func (s *etcd2Session) connectedEndpointList() []string {
s.clientMu.Lock()
defer s.clientMu.Unlock()
return append([]string(nil), s.connectedEndpoints...)
}
func (s *etcd2Session) validateConnection() (any, error) {
client, err := s.activeClient()
if err != nil {
return nil, err
}
ctx, cancel := context.WithTimeout(context.Background(), operationTimeout)
defer cancel()
probe, err := client.probeV2(ctx)View on GitHub (pinned to c0390bff16)
Solutions
- Call connect (or testConnection) successfully before any auth operation
- Check the error returned by connect instead of ignoring it
- Reconnect after a failure and only then retry auth calls
- Serialize session setup before dispatching requests
Example fix
// before
s.authUserList(params) // client==nil
// after
if _, err := s.connect(nil); err != nil { return err }
return s.authUserList(params) Defensive patterns
Strategy: try-catch
Validate before calling
s.clientMu.Lock()
ready := s.httpClient != nil
s.clientMu.Unlock()
if !ready { return errors.New("connect before calling auth operations") } Try / catch
out, err := session.handle(ctx, "authUserList", params)
if err != nil && strings.Contains(err.Error(), "Not connected") {
if _, cerr := session.connect(nil); cerr != nil { return cerr }
out, err = session.handle(ctx, "authUserList", params)
} Prevention
- Always call connect and check its error before issuing requests
- Initialize sessions in one place and hand out only ready sessions
- Re-run connect after any network failure before retrying auth calls
- Add a unit test asserting auth calls fail cleanly pre-connect
When it happens
Trigger: Calling authUserList, authUserGet, authUserAdd, authUserDelete, authUserChangePassword, or authUserGrantRevokeRole before connect succeeds, or after the session was closed/reset.
Common situations: Skipping an explicit connect step assuming calls auto-connect; connect failed earlier and the error was ignored; connection lost and client cleared; using a session across goroutines before initialization completes.
Related errors
- Not connected
- No etcd endpoint configured
- ETCD_WATCH_NOT_FOUND
- JDBC pool registry must be attached before connecting
- Not connected
AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05).
Data as JSON: /api/errors/7b5e532bdde8b436.
Report an issue: GitHub.