netbirdio/netbird · error

restart service

Error message

restart service: %w

What it means

The service-control layer refused or failed the restart of the NetBird system service (e.g. the service manager reported an error, the service is not installed, or the operation was denied). It is thrown by the `netbird service restart` command handler after s.Restart() returns an error, so the success message is not printed and the CLI exits with the underlying cause attached.

Solutions

  1. Check current state with 'netbird service status' and start or stop manually to reach the desired state
  2. Run with elevated privileges and retry
  3. Inspect service-manager logs for the restart failure
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at client/cmd/service_controller.go:317 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/fa246fc0415c742d. Report an issue: GitHub.

Appendix: source

Thrown at client/cmd/service_controller.go:317

		return nil
	},
}

var restartCmd = &cobra.Command{
	Use:   "restart",
	Short: "restarts NetBird service",
	RunE: func(cmd *cobra.Command, args []string) error {
		ctx, cancel := context.WithCancel(cmd.Context())
		s, err := setupServiceControlCommand(cmd, ctx, cancel, false)
		if err != nil {
			return err
		}
		if err := validateJSONSocketFlags(); err != nil {
			return err
		}

		if err := s.Restart(); err != nil {
			return fmt.Errorf("restart service: %w", err)
		}
		cmd.Println("NetBird service has been restarted")
		return nil
	},
}

var svcStatusCmd = &cobra.Command{
	Use:   "status",
	Short: "shows NetBird service status",
	RunE: func(cmd *cobra.Command, args []string) error {
		ctx, cancel := context.WithCancel(cmd.Context())
		s, err := setupServiceControlCommand(cmd, ctx, cancel, true)
		if err != nil {
			return err
		}

		status, err := s.Status()
		if err != nil {

View on GitHub (pinned to 93e97f4bf1)