{"record":{"id":"7ba4f45104ef1991","repo":"cloudflare/cloudflared","slug":"service-uninstallation-is-not-supported-on-this-op","errorCode":null,"errorMessage":"service uninstallation is not supported on this operating system","messagePattern":"service uninstallation is not supported on this operating system","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/cloudflared/generic_service.go","lineNumber":39,"sourceCode":"\t\t\t\tUsage:  \"Install cloudflared as a system service (not supported on this operating system)\",\n\t\t\t\tAction: cliutil.ConfiguredAction(installGenericService),\n\t\t\t},\n\t\t\t{\n\t\t\t\tName:   \"uninstall\",\n\t\t\t\tUsage:  \"Uninstall the cloudflared service (not supported on this operating system)\",\n\t\t\t\tAction: cliutil.ConfiguredAction(uninstallGenericService),\n\t\t\t},\n\t\t},\n\t})\n\tapp.Run(os.Args)\n}\n\nfunc installGenericService(c *cli.Context) error {\n\treturn fmt.Errorf(\"service installation is not supported on this operating system\")\n}\n\nfunc uninstallGenericService(c *cli.Context) error {\n\treturn fmt.Errorf(\"service uninstallation is not supported on this operating system\")\n}\n","sourceCodeStart":21,"sourceCodeEnd":41,"githubUrl":"https://github.com/cloudflare/cloudflared/blob/2253eeeb25a44a713a4b60b8ba1e1b3f377d1a0f/cmd/cloudflared/generic_service.go#L21-L41","documentation":"The uninstall counterpart of the generic service stub: `cloudflared service uninstall` on an OS without native service support returns this error from uninstallGenericService. There is nothing to uninstall because installation was never possible on this platform.","triggerScenarios":"Running `cloudflared service uninstall <name>` on a platform mapped to generic_service.go (BSDs, unsupported init systems, non-Windows/macOS/Linux builds).","commonSituations":"Cleanup scripts that unconditionally run service uninstall across heterogeneous fleets; CI jobs trying to remove a service that was never registered on the platform.","solutions":["Only call `cloudflared service uninstall` on platforms that support service installation (Windows, macOS, Linux with systemd/SysV).","On unsupported platforms, kill the process and remove your own supervisor unit/script instead.","Guard cleanup scripts by checking the OS/init system before invoking the service subcommand.","Ignore/handle this error in scripts as expected output on unsupported platforms (exit code reflects the unsupported operation)."],"exampleFix":"// before: unconditional uninstall in cleanup.sh\ncloudflared service uninstall\n// after: guard on init system\nif [ -d /run/systemd/system ]; then cloudflared service uninstall; fi","handlingStrategy":"validation","validationCode":"// only uninstall where services can exist\nif [ -d /run/systemd/system ] || uname -s | grep -Eq 'Linux|Darwin' || uname -s | grep -q CYGWIN; then\n  cloudflared service uninstall\nfi","typeGuard":"func canUninstallService() bool { return runtime.GOOS == \"windows\" || runtime.GOOS == \"darwin\" || runtime.GOOS == \"linux\" }","tryCatchPattern":"if err := uninstallService(); err != nil {\n\tif strings.Contains(err.Error(), \"not supported on this operating system\") {\n\t\tlog.Info().Msg(\"no service support on this platform; skipping uninstall\")\n\t\treturn nil\n\t}\n\treturn err\n}","preventionTips":["Make cleanup scripts platform-aware before calling service uninstall.","Treat this error as expected no-op output on unsupported platforms.","Standardize on supported platforms (Windows/macOS/Linux) for service-mode deployments."],"tags":["service","unsupported-platform","cloudflared","cli"],"backgroundTag":"unsupported-platform","analyzedSha":"2253eeeb25a44a713a4b60b8ba1e1b3f377d1a0f","analyzedAt":"2026-09-06T04:14:33.757Z","contentChangedAt":"2026-09-06T04:14:33.757Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}