netbirdio/netbird · error

failed to deselect networks: %v

Error message

failed to deselect networks: %v

What it means

The `netbird networks deselect` CLI sent the DeselectNetworksRequest and the daemon returned a gRPC error, surfaced as its status message. Deselection is validated on the daemon against the currently selected networks; nothing selected or unknown IDs fail there.

Source

Thrown at client/cmd/networks.go:167

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,
	}

	if len(args) == 1 && args[0] == "all" {
		req.All = true
	}

	if _, err := client.DeselectNetworks(cmd.Context(), req); err != nil {
		return fmt.Errorf("failed to deselect networks: %v", status.Convert(err).Message())
	}

	cmd.Println("Networks deselected successfully.")

	return nil
}

View on GitHub (pinned to 93e97f4bf1)

Solutions

  1. Run `netbird networks list` to see the current selection and use those exact IDs
  2. Verify peer connectivity with `netbird status` before deselecting
  3. Align CLI and daemon versions (upgrade the service)
  4. Inspect daemon logs for the underlying validation message
Defensive patterns

Strategy: validation

Validate before calling

# Deselect only what is currently selected (shown by list)
netbird networks list   # confirm the IDs appear as selected before deselecting

Try / catch

if _, err := client.DeselectNetworks(cmd.Context(), req); err != nil {
    if st, ok := status.FromError(err); ok && st.Code() == codes.Unimplemented {
        return fmt.Errorf("daemon lacks DeselectNetworks; upgrade the service")
    }
    return fmt.Errorf("deselect networks: %s", status.Convert(err).Message())
}

Prevention

When it happens

Trigger: Deselecting network IDs that are not currently selected; peer not connected to management; identifiers from a stale `networks list`; daemon version without the DeselectNetworks RPC (Unimplemented).

Common situations: Running deselect twice; account networks changed since last list; management unreachable; CLI newer than daemon after partial upgrade.

Related errors


AI-assisted analysis of netbirdio/netbird@93e97f4bf1 (2026-08-16). Data as JSON: /api/errors/ee45fbe434ec34ce. Report an issue: GitHub.