{"record":{"id":"ee45fbe434ec34ce","repo":"netbirdio/netbird","slug":"failed-to-deselect-networks-v","errorCode":null,"errorMessage":"failed to deselect networks: %v","messagePattern":"failed to deselect networks: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/cmd/networks.go","lineNumber":167,"sourceCode":"\nfunc networksDeselect(cmd *cobra.Command, args []string) error {\n\tconn, err := getClient(cmd)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer conn.Close()\n\n\tclient := proto.NewDaemonServiceClient(conn)\n\treq := &proto.SelectNetworksRequest{\n\t\tNetworkIDs: args,\n\t}\n\n\tif len(args) == 1 && args[0] == \"all\" {\n\t\treq.All = true\n\t}\n\n\tif _, err := client.DeselectNetworks(cmd.Context(), req); err != nil {\n\t\treturn fmt.Errorf(\"failed to deselect networks: %v\", status.Convert(err).Message())\n\t}\n\n\tcmd.Println(\"Networks deselected successfully.\")\n\n\treturn nil\n}\n","sourceCodeStart":149,"sourceCodeEnd":174,"githubUrl":"https://github.com/netbirdio/netbird/blob/93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c/client/cmd/networks.go#L149-L174","documentation":"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.","triggerScenarios":"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).","commonSituations":"Running deselect twice; account networks changed since last list; management unreachable; CLI newer than daemon after partial upgrade.","solutions":["Run `netbird networks list` to see the current selection and use those exact IDs","Verify peer connectivity with `netbird status` before deselecting","Align CLI and daemon versions (upgrade the service)","Inspect daemon logs for the underlying validation message"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"# Deselect only what is currently selected (shown by list)\nnetbird networks list   # confirm the IDs appear as selected before deselecting","typeGuard":null,"tryCatchPattern":"if _, err := client.DeselectNetworks(cmd.Context(), req); err != nil {\n    if st, ok := status.FromError(err); ok && st.Code() == codes.Unimplemented {\n        return fmt.Errorf(\"daemon lacks DeselectNetworks; upgrade the service\")\n    }\n    return fmt.Errorf(\"deselect networks: %s\", status.Convert(err).Message())\n}","preventionTips":["Make deselect idempotent in scripts: check current selection first","Keep CLI/daemon versions aligned","Don't reuse stale IDs after account changes"],"tags":["grpc","networks","validation","cli"],"backgroundTag":null,"analyzedSha":"93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c","analyzedAt":"2026-08-16T03:09:19.136Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}