louislam/uptime-kuma · error · Error

Service Name is required.

Error message

Service Name is required.

What it means

Thrown by SystemServiceMonitorType.check() when monitor.system_service_name is null, undefined, or whitespace-only after trimming. The service name is required input for both the systemd (Linux) and Service Manager (Windows) code paths, so without it the check cannot construct a valid command.

Source

Thrown at server/monitor-types/system-service.js:21

const process = require("process");
const { UP } = require("../../src/util");

class SystemServiceMonitorType extends MonitorType {
    name = "system-service";
    description = "Checks if a system service is running (systemd on Linux, Service Manager on Windows).";

    /**
     * Check the system service status.
     * Detects OS and dispatches to the appropriate check method.
     * @param {object} monitor The monitor object containing monitor.system_service_name.
     * @param {object} heartbeat The heartbeat object to update.
     * @returns {Promise<void>} Resolves when check is complete.
     */
    async check(monitor, heartbeat) {
        const serviceName = (monitor.system_service_name || "").trim();

        if (!serviceName) {
            throw new Error("Service Name is required.");
        }

        if (process.platform === "win32") {
            return this.checkWindows(serviceName, heartbeat);
        } else if (process.platform === "linux") {
            return this.checkLinux(serviceName, heartbeat);
        }

        throw new Error(`System Service monitoring is not supported on ${process.platform}`);
    }

    /**
     * Linux Check (Systemd)
     * @param {string} serviceName The name of the service to check.
     * @param {object} heartbeat The heartbeat object.
     * @returns {Promise<void>}
     */
    async checkLinux(serviceName, heartbeat) {

View on GitHub (pinned to 6b5ea01557)

Solutions

  1. Edit the monitor and fill in the Service Name field with the real systemd unit or Windows service name.
  2. If creating monitors programmatically, ensure system_service_name is set and non-empty before saving.
  3. Add form-level validation so the monitor cannot be saved without a service name.
Defensive patterns

Strategy: validation

Validate before calling

function requireServiceName(monitor) {
  const name = (monitor?.system_service_name || "").trim();
  if (!name) throw new Error("Service Name is required.");
  return name;
}

Type guard

function hasServiceName(monitor) { return typeof monitor?.system_service_name === "string" && monitor.system_service_name.trim().length > 0; }

Try / catch

if (!hasServiceName(monitor)) { heartbeat.status = DOWN; heartbeat.msg = "Service Name is required."; return; }

Prevention

When it happens

Trigger: Produced at the top of check() before any platform dispatch, whenever the monitor was created/saved without a system_service_name value or the field contains only whitespace.

Common situations: Monitor created via API/migration that omitted system_service_name; frontend field left blank; an automation script creating a monitor of type 'system-service' without setting the name; trim() removing a value that was only spaces.

Related errors


AI-assisted analysis of louislam/uptime-kuma@6b5ea01557 (2026-08-12). Data as JSON: /api/errors/76439d301424185c. Report an issue: GitHub.