{"record":{"id":"bb1725311e85cf28","repo":"louislam/uptime-kuma","slug":"system-service-monitoring-is-not-supported-on-pr","errorCode":null,"errorMessage":"System Service monitoring is not supported on ${process.platform}","messagePattern":"System Service monitoring is not supported on (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/monitor-types/system-service.js","lineNumber":30,"sourceCode":"     * Detects OS and dispatches to the appropriate check method.\n     * @param {object} monitor The monitor object containing monitor.system_service_name.\n     * @param {object} heartbeat The heartbeat object to update.\n     * @returns {Promise<void>} Resolves when check is complete.\n     */\n    async check(monitor, heartbeat) {\n        const serviceName = (monitor.system_service_name || \"\").trim();\n\n        if (!serviceName) {\n            throw new Error(\"Service Name is required.\");\n        }\n\n        if (process.platform === \"win32\") {\n            return this.checkWindows(serviceName, heartbeat);\n        } else if (process.platform === \"linux\") {\n            return this.checkLinux(serviceName, heartbeat);\n        }\n\n        throw new Error(`System Service monitoring is not supported on ${process.platform}`);\n    }\n\n    /**\n     * Linux Check (Systemd)\n     * @param {string} serviceName The name of the service to check.\n     * @param {object} heartbeat The heartbeat object.\n     * @returns {Promise<void>}\n     */\n    async checkLinux(serviceName, heartbeat) {\n        return new Promise((resolve, reject) => {\n            // SECURITY: Prevent Argument Injection\n            // Only allow alphanumeric, dots, dashes, underscores, and @\n            if (!serviceName || !/^[a-zA-Z0-9._\\-@]+$/.test(serviceName)) {\n                reject(new Error(\"Invalid service name. Please use the internal Service Name (no spaces).\"));\n                return;\n            }\n\n            execFile(\"systemctl\", [\"is-active\", serviceName], { timeout: 5000 }, (error, stdout, stderr) => {","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/louislam/uptime-kuma/blob/6b5ea0155793e666666745fb8d6fef1e829543a2/server/monitor-types/system-service.js#L12-L48","documentation":"Thrown by SystemServiceMonitorType.check() when process.platform is neither 'win32' nor 'linux'. The implementation only ships systemd-based and PowerShell/Get-Service-based checkers, so any other platform (darwin, freebsd, aix, etc.) is explicitly rejected rather than running a meaningless command.","triggerScenarios":"Produced when the Uptime-Kuma process runs on macOS (darwin), a BSD, or any non-Windows/non-Linux OS and a monitor of type 'system-service' is evaluated.","commonSituations":"Developer running Uptime-Kuma locally on macOS and adding a system-service monitor; container host reporting a platform value the code does not recognise; deployment on FreeBSD/solaris.","solutions":["Run system-service monitors only on Linux or Windows hosts; on other platforms, disable or remove the monitor.","If you need macOS/BSD support, implement a new check method (e.g. launchd) and add its platform branch.","Confirm the deployment target platform is reported correctly (process.platform) and matches expectations."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"function isSupportedPlatform() { return [\"linux\", \"win32\"].includes(process.platform); }","typeGuard":"function platformHasChecker() { return typeof this[`check${process.platform === \"win32\" ? \"Windows\" : \"Linux\"}`] === \"function\"; }","tryCatchPattern":"if (!isSupportedPlatform()) { heartbeat.status = DOWN; heartbeat.msg = `Unsupported platform: ${process.platform}`; return; }","preventionTips":["Only deploy system-service monitors on Linux/Windows hosts.","Detect platform at monitor-creation time and warn the user.","Add new platform handlers (e.g. launchd) instead of loosening the check."],"tags":["system-service","platform","os","compatibility"],"backgroundTag":null,"analyzedSha":"6b5ea0155793e666666745fb8d6fef1e829543a2","analyzedAt":"2026-08-12T23:42:12.959Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}