netbirdio/netbird · error

daemon login failed

Error message

daemon login failed: %v

What it means

Wraps a failure from doDaemonLogin: when the NetBird daemon/service is running, `netbird login` delegates authentication to the daemon over its IPC socket, and this error surfaces any login failure reported back by the daemon. It fires whenever the daemon-side login (management connection, profile handling, or credential exchange) returns an error, so the CLI command exits non-zero instead of silently reporting success.

Solutions

  1. Read the inner error to see whether it was daemon connectivity, the Login RPC, or SSO
  2. Ensure the daemon is installed and running ('netbird service install && netbird service start')
  3. For SSO failures, complete the browser flow and retry login
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at client/cmd/login.go:92 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at client/cmd/login.go:92

			if providedSetupKey != "" {
				return fmt.Errorf("--extend cannot be combined with a setup key; setup keys can only enrol new peers")
			}
			if err := doExtendSession(ctx, cmd); err != nil {
				return fmt.Errorf("extend session failed: %v", err)
			}
			return nil
		}

		// workaround to run without service
		if util.FindFirstLogPath(logFiles) == "" {
			if err := doForegroundLogin(ctx, cmd, providedSetupKey, activeProf); err != nil {
				return fmt.Errorf("foreground login failed: %v", err)
			}
			return nil
		}

		if err := doDaemonLogin(ctx, cmd, providedSetupKey, activeProf, username.Username, pm); err != nil {
			return fmt.Errorf("daemon login failed: %v", err)
		}

		cmd.Println("Logging successfully")

		return nil
	},
}

func doDaemonLogin(ctx context.Context, cmd *cobra.Command, providedSetupKey string, activeProf *profilemanager.Profile, username string, pm *profilemanager.ProfileManager) 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()

View on GitHub (pinned to 93e97f4bf1)