{"record":{"id":"ff0dbb827ed57a6a","repo":"netbirdio/netbird","slug":"unable-to-get-daemon-status-v","errorCode":null,"errorMessage":"unable to get daemon status: %v","messagePattern":"unable to get daemon status: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/cmd/login.go","lineNumber":275,"sourceCode":"\t\treturn fmt.Errorf(\"switch profile on daemon: %v\", err)\n\t}\n\n\tif err := pm.SwitchProfile(resolvedID); err != nil {\n\t\treturn fmt.Errorf(\"switch profile: %v\", err)\n\t}\n\n\tconn, err := DialClientGRPCServer(ctx, daemonAddr)\n\tif err != nil {\n\t\tlog.Errorf(\"failed to connect to service CLI interface %v\", err)\n\t\treturn err\n\t}\n\tdefer conn.Close()\n\n\tclient := proto.NewDaemonServiceClient(conn)\n\n\tstatus, err := client.Status(ctx, &proto.StatusRequest{})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to get daemon status: %v\", err)\n\t}\n\n\tif status.Status == string(internal.StatusConnected) {\n\t\tif _, err := client.Down(ctx, &proto.DownRequest{}); err != nil {\n\t\t\tlog.Errorf(\"call service down method: %v\", err)\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}\n\n// switchProfile asks the daemon to switch to the profile identified by\n// handle (a name, ID, or unique ID prefix). Returns the resolved profile\n// ID so the caller can update the local active-profile state without\n// re-resolving the handle.\nfunc switchProfile(ctx context.Context, handle string, username string) (profilemanager.ID, error) {\n\tconn, err := DialClientGRPCServer(ctx, daemonAddr)","sourceCodeStart":257,"sourceCodeEnd":293,"githubUrl":"https://github.com/netbirdio/netbird/blob/93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c/client/cmd/login.go#L257-L293","documentation":"After switching profiles locally, the CLI calls daemon Status to decide whether to also call Down (teardown) so the new profile takes effect. This error means that Status RPC failed. Because it fires right after a profile switch, the common cause is the daemon reconnecting or reloading its gRPC listener/configuration as part of the switch, or the daemon having crashed during the reload.","triggerScenarios":"Daemon restarting its internal components after SwitchProfile while the CLI immediately calls Status; daemon crash mid-reload; connection to the unix socket/named pipe dropped; permission change on the socket between calls.","commonSituations":"Profile switch on a connected peer triggers a config reload that races the Status call; Service upgrade or crash-looping daemon; Stale socket file left by a killed daemon","solutions":["Check the daemon is alive and healthy: 'netbird service status', 'systemctl status netbird', and the daemon logs","Retry the original command; if the daemon finished reloading, Status will now succeed","If the daemon crashed, investigate its logs (journalctl -u netbird) before retrying","Confirm final state with 'netbird status' and re-run Down/up if the old profile is still active"],"exampleFix":"// before: single shot, fails when the daemon is mid-reload\nstatus, err := client.Status(ctx, &proto.StatusRequest{})\nif err != nil {\n    return fmt.Errorf(\"unable to get daemon status: %v\", err)\n}\n\n// after: tolerate a transient reload with a short retry\nvar status *proto.StatusResponse\nfor attempt := 0; attempt < 3; attempt++ {\n    status, err = client.Status(ctx, &proto.StatusRequest{})\n    if err == nil {\n        break\n    }\n    time.Sleep(500 * time.Duration(att+1) * time.Millisecond)\n}\nif err != nil {\n    return fmt.Errorf(\"unable to get daemon status: %w\", err)\n}","handlingStrategy":"retry","validationCode":"// Gate on daemon readiness before the Status call\nif _, err := client.Status(ctx, &proto.StatusRequest{}); err != nil {\n    return fmt.Errorf(\"daemon not ready before switch: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"var status *proto.StatusResponse\nerr = backoff.Retry(func() error {\n    var e error\n    status, e = client.Status(ctx, &proto.StatusRequest{})\n    return e\n}, backoff.WithMaxRetries(backoff.NewExponentialBackOff(), 3))\nif err != nil {\n    return fmt.Errorf(\"unable to get daemon status: %w\", err)\n}","preventionTips":["Expect a short reload window after SwitchProfile; build a retry into callers that chain Status immediately after","Monitor daemon health (systemctl/journal) when scripting profile switches","If Status keeps failing, check for a crash-looping daemon before retrying further"],"tags":["grpc","daemon","profile-switch","transient","netbird"],"backgroundTag":null,"analyzedSha":"93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c","analyzedAt":"2026-08-16T03:09:19.136Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}