{"record":{"id":"5e788ad5242b8d6a","repo":"netbirdio/netbird","slug":"failed-to-connect-to-daemon-error-v-if-the-daemo-5e788a","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":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/cmd/up.go","lineNumber":187,"sourceCode":"\t\t\t}\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif err := pm.SwitchProfile(resolvedID); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}\n\n// createProfile dials the daemon and creates a new profile with the given\n// display name, returning its generated ID. Use addProfileOnDaemon directly\n// when a daemon client is already available to reuse the connection.\nfunc createProfile(ctx context.Context, profileName, username string) (profilemanager.ID, 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\treturn addProfileOnDaemon(ctx, proto.NewDaemonServiceClient(conn), profileName, username)\n}\n\nfunc runInForegroundMode(ctx context.Context, cmd *cobra.Command, activeProf *profilemanager.Profile) error {\n\t// override the default profile filepath if provided\n\tif configPath != \"\" {\n\t\t_ = profilemanager.NewServiceManager(configPath)\n\t}\n\n\terr := handleRebrand(cmd)\n\tif err != nil {\n\t\treturn err\n\t}","sourceCodeStart":169,"sourceCodeEnd":205,"githubUrl":"https://github.com/netbirdio/netbird/blob/93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c/client/cmd/up.go#L169-L205","documentation":"Thrown by createProfile (client/cmd/up.go:187) when DialClientGRPCServer(ctx, daemonAddr) cannot connect to the daemon's IPC socket (unix socket such as /var/run/netbird.sock, or the Windows named pipe npipe://netbird). The message embeds recovery instructions because profile auto-create is one of the first operations that needs a live daemon. Same failure shape as the dial in runInDaemonMode.","triggerScenarios":"'netbird up --profile <name>' (or any path hitting createProfile) while the netbird service is not installed/started; the socket file missing or replaced; permission denial on the unix socket (wrong group/SELinux/AppArmor); the daemon still initializing its listener.","commonSituations":"Fresh installs where 'netbird service install/start' was skipped; the service crashed (check journalctl/systemctl); running the CLI as a user denied access to the socket; Windows named pipe ACLs blocking non-admin callers.","solutions":["Run 'netbird service install' and 'netbird service start' (exactly as the error text instructs), then retry","Check service health: systemctl status netbird / journalctl -u netbird (or the Windows service), and restart if crashed","Verify the socket exists and is accessible (ls -l /var/run/netbird.sock; adjust group/permissions or SELinux policy)","If the daemon was just started, give it a moment and retry - the listener may still be binding"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// unix socket: confirm the daemon listener exists before dialing\nif _, err := os.Stat(\"/var/run/netbird.sock\"); err != nil {\n    log.Fatal(\"daemon socket missing: run netbird service install && netbird service start\")\n}","typeGuard":"func isDaemonUnavailable(err error) bool {\n    st, ok := gstatus.FromError(err)\n    return ok && st.Code() == codes.Unavailable\n}","tryCatchPattern":"conn, err := DialClientGRPCServer(ctx, daemonAddr)\nif err != nil {\n    if strings.Contains(err.Error(), \"connect: no such file or directory\") {\n        // socket absent: guide to install/start the service, then retry once\n    }\n    return err\n}","preventionTips":["Install and start the service before any profile-dependent command","Monitor the netbird service (systemd Restart=always) so the socket stays up","Verify socket permissions if running the CLI as non-root"],"tags":["cli","daemon","ipc","service","netbird"],"backgroundTag":null,"analyzedSha":"93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c","analyzedAt":"2026-08-16T03:09:19.136Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}