netbirdio/netbird · warning
not connected
Error message
not connected
What it means
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.
Source
Thrown at client/android/client.go:539
dnsServer.OnUpdatedHostDNSServer(slices.Clone(list.items))
return nil
}
// SetConnectionListener set the network connection listener
func (c *Client) SetConnectionListener(listener ConnectionListener) {
c.recorder.SetConnectionListener(listener)
}
// RemoveConnectionListener remove connection listener
func (c *Client) RemoveConnectionListener() {
c.recorder.RemoveConnectionListener()
}
func (c *Client) getRouteManager() (routemanager.Manager, error) {
client := c.getConnectClient()
if client == nil {
return nil, fmt.Errorf("not connected")
}
engine := client.Engine()
if engine == nil {
return nil, fmt.Errorf("engine is not running")
}
manager := engine.GetRouteManager()
if manager == nil {
return nil, fmt.Errorf("could not get route manager")
}
return manager, nil
}
func (c *Client) SelectRoute(id string) error {
manager, err := c.getRouteManager()
if err != nil {View on GitHub (pinned to 93e97f4bf1)
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.
Defensive patterns
Strategy: validation
Validate before calling
// Guard route APIs on connection state before calling them
client := getConnectClient()
if client == nil {
return fmt.Errorf("connect before selecting routes")
} Try / catch
if err := client.SelectRoute(id); err != nil {
if err.Error() == "not connected" {
// precondition failure: connect first, then re-issue the selection
}
} Prevention
- 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.
When it happens
Trigger: Calling SelectRoute or similar route APIs before Connect completes; calling them after the connect client was torn down on disconnect.
Common situations: UI rendering a route list before the tunnel is up; user tapping a route while the app reconnects.
Related errors
- engine is not running
- failed to resolve active profile %q: %w
- engine is not running
- device is not ready yet
- device is not ready yet
AI-assisted analysis of netbirdio/netbird@93e97f4bf1 (2026-08-16).
Data as JSON: /api/errors/21f71d66e75b894a.
Report an issue: GitHub.