netbirdio/netbird · error

unable to get daemon status: %v

Error message

unable to get daemon status: %v

What it means

After dialing, the CLI calls client.Status with WaitForReady=true, which blocks until the daemon's gRPC server is serving and then returns its status. This error means that wait failed: the connection broke, the context was canceled, or the daemon never reached a serving state within the wait. It is distinct from 421 in that the dial succeeded but the status RPC did not complete.

Source

Thrown at client/cmd/up.go:302

		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 func() {
		err := conn.Close()
		if err != nil {
			log.Warnf("failed closing daemon gRPC client connection %v", err)
			return
		}
	}()

	client := proto.NewDaemonServiceClient(conn)

	status, err := client.Status(ctx, &proto.StatusRequest{
		WaitForReady: func() *bool { b := true; return &b }(),
	})
	if err != nil {
		return fmt.Errorf("unable to get daemon status: %v", err)
	}

	if status.Status == string(internal.StatusConnected) {
		if !profileSwitched {
			cmd.Println("Already connected")
			return nil
		}

		if _, err := client.Down(ctx, &proto.DownRequest{}); err != nil {
			log.Errorf("call service down method: %v", err)
			return err
		}
	}

	username, err := user.Current()
	if err != nil {
		return fmt.Errorf("get current user: %v", err)
	}

View on GitHub (pinned to 93e97f4bf1)

Solutions

  1. Confirm the daemon stays up: `netbird service status`; if it restarts, inspect journalctl -u netbird (or Windows service logs)
  2. Retry the command after the service reports running
  3. If the daemon crash-loops, run `netbird service run --log-level debug` in foreground and fix the reported startup error
Defensive patterns

Strategy: retry

Try / catch

// WaitForReady hides startup races; retry once after the service reports active
if err := runUp(); err != nil && strings.Contains(err.Error(), "unable to get daemon status") {
	time.Sleep(2 * time.Second)
	err = runUp()
}

Prevention

When it happens

Trigger: Daemon is still initializing and the connection drops; daemon crashes between dial and Status; the CLI context is canceled (Ctrl+C) while blocked in WaitForReady; socket closed by a daemon restart racing the CLI.

Common situations: Running `netbird up` immediately after `netbird service start` on slow machines, daemon OOM-killed during startup, or restarting the service while a CLI command is in flight.

Related errors


AI-assisted analysis of netbirdio/netbird@93e97f4bf1 (2026-08-16). Data as JSON: /api/errors/1f6be5190e5f0e7d. Report an issue: GitHub.