{"record":{"id":"ce54d2b2932d8dff","repo":"henrygd/beszel","slug":"systemd-manager-unavailable","errorCode":null,"errorMessage":"systemd manager unavailable","messagePattern":"systemd manager unavailable","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agent/systemd_nonlinux.go","lineNumber":37,"sourceCode":"}\n\n// getServiceStats returns nil for non-linux systems.\nfunc (sm *systemdManager) getServiceStats(conn any, refresh bool) []*systemd.Service {\n\treturn nil\n}\n\n// getServiceStatsCount returns 0 for non-linux systems.\nfunc (sm *systemdManager) getServiceStatsCount() int {\n\treturn 0\n}\n\n// getFailedServiceCount returns 0 for non-linux systems.\nfunc (sm *systemdManager) getFailedServiceCount() uint16 {\n\treturn 0\n}\n\nfunc (sm *systemdManager) getServiceDetails(string) (systemd.ServiceDetails, error) {\n\treturn nil, errors.New(\"systemd manager unavailable\")\n}\n","sourceCodeStart":19,"sourceCodeEnd":39,"githubUrl":"https://github.com/henrygd/beszel/blob/b38fb7dafa60812cc22e6a84ce313e94f1ce0a32/agent/systemd_nonlinux.go#L19-L39","documentation":"On non-Linux platforms, systemdManager is a stub that cannot query systemd. getServiceDetails always returns the error 'systemd manager unavailable', while getFailedServiceCount returns 0. The code compiles on all platforms but systemd data is only available on Linux with a real systemd implementation.","triggerScenarios":"getServiceDetails is called on any non-Linux OS (or a Linux build using the nonlinux stub file), or on Linux when the build tag excluded the real systemd implementation.","commonSituations":"Running the hub/agent on macOS or Windows during development while systemd monitoring is enabled for a system; deploying in a container without systemd despite a Linux runtime.","solutions":["Only enable systemd monitoring for systems running on Linux with actual systemd (PID 1)","Check platform-specific build tags — ensure the real systemd implementation file is included on Linux builds","Disable the systemd/failed-services metric for non-Linux systems in the hub UI"],"exampleFix":"// before: querying service details on a macOS dev machine\nsm.getServiceDetails(\"nginx.service\")\n// after: guard by GOOS\nif runtime.GOOS != \"linux\" { return } // skip systemd queries","handlingStrategy":"fallback","validationCode":"// only query systemd on linux\nif runtime.GOOS != \"linux\" {\n    return // skip service details\n}","typeGuard":null,"tryCatchPattern":"details, err := sm.getServiceDetails(name)\nif err != nil && err.Error() == \"systemd manager unavailable\" {\n    details = defaultUnavailableDetails() // graceful degradation\n}","preventionTips":["Enable systemd monitoring only for Linux hosts running systemd","Skip this metric for macOS/Windows dev machines and containers without systemd","Gate the feature behind a GOOS check or config flag"],"tags":["systemd","platform","linux","stub"],"backgroundTag":"unsupported-platform-api","analyzedSha":"b38fb7dafa60812cc22e6a84ce313e94f1ce0a32","analyzedAt":"2026-08-31T15:10:10.149Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}