netbirdio/netbird · error
stop service
Error message
stop service: %w
What it means
The service-control stop command failed to stop the running netbird service through the OS service manager. Usually privileges or a service in a transitional state; the daemon may still be running afterwards.
Solutions
- Run with elevated privileges
- Check 'netbird service status'; retry stop after a transitional state settles
- If the service is stuck, use the OS service manager directly to inspect why
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at client/cmd/service_controller.go:296 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/9faeddbca6b1eb75.
Report an issue: GitHub.
Appendix: source
Thrown at client/cmd/service_controller.go:296
return fmt.Errorf("start service: %w", err)
}
cmd.Println("NetBird service has been started")
return nil
},
}
var stopCmd = &cobra.Command{
Use: "stop",
Short: "stops 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 := s.Stop(); err != nil {
return fmt.Errorf("stop service: %w", err)
}
cmd.Println("NetBird service has been stopped")
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
}View on GitHub (pinned to 93e97f4bf1)