{"record":{"id":"7b5e532bdde8b436","repo":"t8y2/dbx","slug":"not-connected-7b5e53","errorCode":null,"errorMessage":"Not connected","messagePattern":"Not connected","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agents/drivers/etcd2-go/client.go","lineNumber":100,"sourceCode":"\t\ts.clientMu.Lock()\n\t\ts.httpClient = client\n\t\ts.connectedEndpoints = endpointList\n\t\ts.serverVersion = client.serverVersion\n\t\ts.clientMu.Unlock()\n\t\treturn map[string]bool{\"ok\": true}, nil\n\t}\n\tif lastErr == nil {\n\t\tlastErr = errors.New(\"No etcd endpoint configured\")\n\t}\n\treturn nil, lastErr\n}\n\nfunc (s *etcd2Session) activeClient() (*authenticatedClient, error) {\n\ts.clientMu.Lock()\n\tclient := s.httpClient\n\ts.clientMu.Unlock()\n\tif client == nil {\n\t\treturn nil, errors.New(\"Not connected\")\n\t}\n\treturn client, nil\n}\n\nfunc (s *etcd2Session) connectedEndpointList() []string {\n\ts.clientMu.Lock()\n\tdefer s.clientMu.Unlock()\n\treturn append([]string(nil), s.connectedEndpoints...)\n}\n\nfunc (s *etcd2Session) validateConnection() (any, error) {\n\tclient, err := s.activeClient()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tctx, cancel := context.WithTimeout(context.Background(), operationTimeout)\n\tdefer cancel()\n\tprobe, err := client.probeV2(ctx)","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/etcd2-go/client.go#L82-L118","documentation":"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.","triggerScenarios":"Calling authUserList, authUserGet, authUserAdd, authUserDelete, authUserChangePassword, or authUserGrantRevokeRole before connect succeeds, or after the session was closed/reset.","commonSituations":"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.","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"],"exampleFix":"// before\ns.authUserList(params) // client==nil\n// after\nif _, err := s.connect(nil); err != nil { return err }\nreturn s.authUserList(params)","handlingStrategy":"try-catch","validationCode":"s.clientMu.Lock()\nready := s.httpClient != nil\ns.clientMu.Unlock()\nif !ready { return errors.New(\"connect before calling auth operations\") }","typeGuard":null,"tryCatchPattern":"out, err := session.handle(ctx, \"authUserList\", params)\nif err != nil && strings.Contains(err.Error(), \"Not connected\") {\n\tif _, cerr := session.connect(nil); cerr != nil { return cerr }\n\tout, err = session.handle(ctx, \"authUserList\", params)\n}","preventionTips":["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"],"tags":["etcd","connectivity","lifecycle"],"backgroundTag":"not-connected","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"}