netbirdio/netbird · error
failed to select networks: %v
Error message
failed to select networks: %v
What it means
The `netbird networks select` CLI sent a SelectNetworksRequest (NetworkIDs from args, or All=true for the literal 'all', Append=true with --append) and the daemon returned a gRPC error whose message is surfaced. The daemon validates the network identifiers against the management network map; unknown IDs or a disconnected peer produce this error.
Source
Thrown at client/cmd/networks.go:142
conn, err := getClient(cmd)
if err != nil {
return err
}
defer conn.Close()
client := proto.NewDaemonServiceClient(conn)
req := &proto.SelectNetworksRequest{
NetworkIDs: args,
}
if len(args) == 1 && args[0] == "all" {
req.All = true
} else if appendFlag {
req.Append = true
}
if _, err := client.SelectNetworks(cmd.Context(), req); err != nil {
return fmt.Errorf("failed to select networks: %v", status.Convert(err).Message())
}
cmd.Println("Networks selected successfully.")
return nil
}
func networksDeselect(cmd *cobra.Command, args []string) error {
conn, err := getClient(cmd)
if err != nil {
return err
}
defer conn.Close()
client := proto.NewDaemonServiceClient(conn)
req := &proto.SelectNetworksRequest{
NetworkIDs: args,
}View on GitHub (pinned to 93e97f4bf1)
Solutions
- Run `netbird networks list` first and copy the exact identifiers from its output
- Confirm `netbird status` shows the peer Connected, then retry the select
- Upgrade the daemon service so its SelectNetworks RPC matches the CLI
- Check daemon logs for the specific validation message behind the gRPC status
Defensive patterns
Strategy: validation
Validate before calling
# Only pass identifiers that the daemon itself reported netbird networks list # copy exact IDs from this output before selecting
Try / catch
if _, err := client.SelectNetworks(cmd.Context(), req); err != nil {
if st, ok := status.FromError(err); ok {
switch st.Code() {
case codes.Unimplemented:
return fmt.Errorf("upgrade the daemon: %s", st.Message())
default:
return fmt.Errorf("select networks: %s", st.Message())
}
}
return err
} Prevention
- Always source network IDs from a fresh `networks list`
- Use the literal 'all' rather than enumerating when selecting everything
- Verify peer connectivity before mutating selection
When it happens
Trigger: Passing network routes/IDs not present in the account; using 'all' while the daemon has no networks; Append semantics rejected by daemon validation; peer not connected to management so the selection cannot be applied; daemon older than the select-networks RPC (Unimplemented).
Common situations: Copy-pasted network identifier from another account/environment; typo in the network ID; running select before the first successful `networks list`; version skew between CLI and daemon.
Related errors
- failed to deselect networks: %v
- resource not part of network
- not a valid host, subnet, or domain
- router not part of network
- peer and peer_groups cannot be set at the same time
AI-assisted analysis of netbirdio/netbird@93e97f4bf1 (2026-08-16).
Data as JSON: /api/errors/c8ca55d8d1c2bbe2.
Report an issue: GitHub.