{"record":{"id":"ac133479c3befc3f","repo":"netbirdio/netbird","slug":"failed-to-connect-to-daemon-error-v-if-the-daemo","errorCode":null,"errorMessage":"failed to connect to daemon error: %v\nIf the daemon is not running please run: \nnetbird service install \nnetbird service start\n","messagePattern":"failed to connect to daemon error: (.+?)\nIf the daemon is not running please run: \nnetbird service install \nnetbird service start\n","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/cmd/login.go","lineNumber":105,"sourceCode":"\t\t\t}\n\t\t\treturn nil\n\t\t}\n\n\t\tif err := doDaemonLogin(ctx, cmd, providedSetupKey, activeProf, username.Username, pm); err != nil {\n\t\t\treturn fmt.Errorf(\"daemon login failed: %v\", err)\n\t\t}\n\n\t\tcmd.Println(\"Logging successfully\")\n\n\t\treturn nil\n\t},\n}\n\nfunc doDaemonLogin(ctx context.Context, cmd *cobra.Command, providedSetupKey string, activeProf *profilemanager.Profile, username string, pm *profilemanager.ProfileManager) error {\n\tconn, err := DialClientGRPCServer(ctx, daemonAddr)\n\tif err != nil {\n\t\t//nolint\n\t\treturn fmt.Errorf(\"failed to connect to daemon error: %v\\n\"+\n\t\t\t\"If the daemon is not running please run: \"+\n\t\t\t\"\\nnetbird service install \\nnetbird service start\\n\", err)\n\t}\n\tdefer conn.Close()\n\n\tclient := proto.NewDaemonServiceClient(conn)\n\n\tvar dnsLabelsReq []string\n\tif dnsLabelsValidated != nil {\n\t\tdnsLabelsReq = dnsLabelsValidated.ToSafeStringList()\n\t}\n\n\thandle := activeProf.ID.String()\n\n\tloginRequest := proto.LoginRequest{\n\t\tSetupKey:            providedSetupKey,\n\t\tManagementUrl:       managementURL,\n\t\tIsUnixDesktopClient: util.HasGraphicalSession(),","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/netbirdio/netbird/blob/93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c/client/cmd/login.go#L87-L123","documentation":"Error \"failed to connect to daemon error: %v\nIf the daemon is not running please run: \nnetbird service install \nnetbird service start\n\" thrown in netbirdio/netbird.","triggerScenarios":"Thrown at client/cmd/login.go:105 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c","analyzedAt":"2026-08-16T03:09:19.136Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}