netbirdio/netbird · error
failed to connect to daemon error: %v If the daemon is not r
Error message
failed to connect to daemon error: %v If the daemon is not running please run: netbird service install netbird service start
What it means
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.
Source
Thrown at client/cmd/up.go:187
}
return err
}
}
if err := pm.SwitchProfile(resolvedID); err != nil {
return err
}
return nil
}
// createProfile dials the daemon and creates a new profile with the given
// display name, returning its generated ID. Use addProfileOnDaemon directly
// when a daemon client is already available to reuse the connection.
func createProfile(ctx context.Context, profileName, username string) (profilemanager.ID, error) {
conn, err := DialClientGRPCServer(ctx, daemonAddr)
if err != nil {
//nolint
return "", fmt.Errorf("failed to connect to daemon error: %v\n"+
"If the daemon is not running please run: "+
"\nnetbird service install \nnetbird service start\n", err)
}
defer conn.Close()
return addProfileOnDaemon(ctx, proto.NewDaemonServiceClient(conn), profileName, username)
}
func runInForegroundMode(ctx context.Context, cmd *cobra.Command, activeProf *profilemanager.Profile) error {
// override the default profile filepath if provided
if configPath != "" {
_ = profilemanager.NewServiceManager(configPath)
}
err := handleRebrand(cmd)
if err != nil {
return err
}View on GitHub (pinned to 93e97f4bf1)
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
Defensive patterns
Strategy: validation
Validate before calling
// unix socket: confirm the daemon listener exists before dialing
if _, err := os.Stat("/var/run/netbird.sock"); err != nil {
log.Fatal("daemon socket missing: run netbird service install && netbird service start")
} Type guard
func isDaemonUnavailable(err error) bool {
st, ok := gstatus.FromError(err)
return ok && st.Code() == codes.Unavailable
} Try / catch
conn, err := DialClientGRPCServer(ctx, daemonAddr)
if err != nil {
if strings.Contains(err.Error(), "connect: no such file or directory") {
// socket absent: guide to install/start the service, then retry once
}
return err
} Prevention
- 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
When it happens
Trigger: '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.
Common situations: 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.
Related errors
- %s: %w
- failed to set log level: %v
- wait for extend session: %v
- switch profile: %v
- switch profile on daemon: %v
AI-assisted analysis of netbirdio/netbird@93e97f4bf1 (2026-08-16).
Data as JSON: /api/errors/5e788ad5242b8d6a.
Report an issue: GitHub.