{"record":{"id":"c8ca55d8d1c2bbe2","repo":"netbirdio/netbird","slug":"failed-to-select-networks-v","errorCode":null,"errorMessage":"failed to select networks: %v","messagePattern":"failed to select networks: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/cmd/networks.go","lineNumber":142,"sourceCode":"\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} else if appendFlag {\n\t\treq.Append = true\n\t}\n\n\tif _, err := client.SelectNetworks(cmd.Context(), req); err != nil {\n\t\treturn fmt.Errorf(\"failed to select networks: %v\", status.Convert(err).Message())\n\t}\n\n\tcmd.Println(\"Networks selected successfully.\")\n\n\treturn nil\n}\n\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}","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/netbirdio/netbird/blob/93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c/client/cmd/networks.go#L124-L160","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"# Only pass identifiers that the daemon itself reported\nnetbird networks list   # copy exact IDs from this output before selecting","typeGuard":null,"tryCatchPattern":"if _, err := client.SelectNetworks(cmd.Context(), req); err != nil {\n    if st, ok := status.FromError(err); ok {\n        switch st.Code() {\n        case codes.Unimplemented:\n            return fmt.Errorf(\"upgrade the daemon: %s\", st.Message())\n        default:\n            return fmt.Errorf(\"select networks: %s\", st.Message())\n        }\n    }\n    return err\n}","preventionTips":["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"],"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"}