{"record":{"id":"fa246fc0415c742d","repo":"netbirdio/netbird","slug":"restart-service-w","errorCode":null,"errorMessage":"restart service: %w","messagePattern":"restart service: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/cmd/service_controller.go","lineNumber":317,"sourceCode":"\t\treturn nil\n\t},\n}\n\nvar restartCmd = &cobra.Command{\n\tUse:   \"restart\",\n\tShort: \"restarts NetBird service\",\n\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\tctx, cancel := context.WithCancel(cmd.Context())\n\t\ts, err := setupServiceControlCommand(cmd, ctx, cancel, false)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := validateJSONSocketFlags(); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := s.Restart(); err != nil {\n\t\t\treturn fmt.Errorf(\"restart service: %w\", err)\n\t\t}\n\t\tcmd.Println(\"NetBird service has been restarted\")\n\t\treturn nil\n\t},\n}\n\nvar svcStatusCmd = &cobra.Command{\n\tUse:   \"status\",\n\tShort: \"shows NetBird service status\",\n\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\tctx, cancel := context.WithCancel(cmd.Context())\n\t\ts, err := setupServiceControlCommand(cmd, ctx, cancel, true)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tstatus, err := s.Status()\n\t\tif err != nil {","sourceCodeStart":299,"sourceCodeEnd":335,"githubUrl":"https://github.com/netbirdio/netbird/blob/93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c/client/cmd/service_controller.go#L299-L335","documentation":"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.","triggerScenarios":"Thrown at client/cmd/service_controller.go:317 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check current state with 'netbird service status' and start or stop manually to reach the desired state","Run with elevated privileges and retry","Inspect service-manager logs for the restart failure"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c","analyzedAt":"2026-08-16T03:09:19.136Z","contentChangedAt":"2026-08-16T03:09:19.136Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}