{"record":{"id":"21f71d66e75b894a","repo":"netbirdio/netbird","slug":"not-connected","errorCode":null,"errorMessage":"not connected","messagePattern":"not connected","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"client/android/client.go","lineNumber":539,"sourceCode":"\n\tdnsServer.OnUpdatedHostDNSServer(slices.Clone(list.items))\n\treturn nil\n}\n\n// SetConnectionListener set the network connection listener\nfunc (c *Client) SetConnectionListener(listener ConnectionListener) {\n\tc.recorder.SetConnectionListener(listener)\n}\n\n// RemoveConnectionListener remove connection listener\nfunc (c *Client) RemoveConnectionListener() {\n\tc.recorder.RemoveConnectionListener()\n}\n\nfunc (c *Client) getRouteManager() (routemanager.Manager, error) {\n\tclient := c.getConnectClient()\n\tif client == nil {\n\t\treturn nil, fmt.Errorf(\"not connected\")\n\t}\n\n\tengine := client.Engine()\n\tif engine == nil {\n\t\treturn nil, fmt.Errorf(\"engine is not running\")\n\t}\n\n\tmanager := engine.GetRouteManager()\n\tif manager == nil {\n\t\treturn nil, fmt.Errorf(\"could not get route manager\")\n\t}\n\n\treturn manager, nil\n}\n\nfunc (c *Client) SelectRoute(id string) error {\n\tmanager, err := c.getRouteManager()\n\tif err != nil {","sourceCodeStart":521,"sourceCodeEnd":557,"githubUrl":"https://github.com/netbirdio/netbird/blob/93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c/client/android/client.go#L521-L557","documentation":"Android Client.getRouteManager is the gate for route APIs such as SelectRoute. It returns this error when getConnectClient() is nil, meaning Connect was never called or the client has not reached (or has lost) the connected state. It is a lifecycle precondition failure, not a network error.","triggerScenarios":"Calling SelectRoute or similar route APIs before Connect completes; calling them after the connect client was torn down on disconnect.","commonSituations":"UI rendering a route list before the tunnel is up; user tapping a route while the app reconnects.","solutions":["Call Connect and wait for the connected status before invoking route APIs.","Track connection state via SetConnectionListener and disable route UI in disconnected states.","Surface this error to the user as 'not connected' rather than treating it as a bug."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Guard route APIs on connection state before calling them\nclient := getConnectClient()\nif client == nil {\n    return fmt.Errorf(\"connect before selecting routes\")\n}","typeGuard":null,"tryCatchPattern":"if err := client.SelectRoute(id); err != nil {\n    if err.Error() == \"not connected\" {\n        // precondition failure: connect first, then re-issue the selection\n    }\n}","preventionTips":["Track connection state with SetConnectionListener and disable route UI while disconnected.","Treat 'not connected' as a user-facing state message, never as an unexpected exception.","Do not cache route-manager handles across connect/disconnect cycles."],"tags":["android","routes","lifecycle","state","precondition"],"backgroundTag":null,"analyzedSha":"93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c","analyzedAt":"2026-08-16T03:09:19.136Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}