louislam/uptime-kuma · error · Error

PM2 process name is required.

Error message

PM2 process name is required.

What it means

validate() for type 'pm2': after trimming system_service_name, if it is empty this is thrown (the 'system-service' type produces a sibling 'Service Name is required.' message from the same line).

Source

Thrown at server/model/monitor.js:1697

                JSON.parse(this.headers);
            } catch (e) {
                throw new Error(`Headers must be valid JSON: ${e.message}`);
            }
        }

        if (this.accepted_statuscodes_json) {
            try {
                JSON.parse(this.accepted_statuscodes_json);
            } catch (e) {
                throw new Error(`Accepted status codes must be valid JSON: ${e.message}`);
            }
        }

        if (["system-service", "pm2"].includes(this.type)) {
            this.system_service_name = (this.system_service_name || "").trim();

            if (!this.system_service_name) {
                throw new Error(this.type === "pm2" ? "PM2 process name is required." : "Service Name is required.");
            }
        }

        if (this.type === "system-service" && !/^[a-zA-Z0-9._\-@]+$/.test(this.system_service_name)) {
            throw new Error("Invalid service name. Please use the internal Service Name (no spaces).");
        }

        if (this.type === "pm2" && /[\u0000-\u001F\u007F]/.test(this.system_service_name)) {
            throw new Error("Invalid PM2 process name.");
        }

        if (this.type === "ping") {
            // ping parameters validation
            if (this.packetSize && (this.packetSize < PING_PACKET_SIZE_MIN || this.packetSize > PING_PACKET_SIZE_MAX)) {
                throw new Error(
                    `Packet size must be between ${PING_PACKET_SIZE_MIN} and ${PING_PACKET_SIZE_MAX} (default: ${PING_PACKET_SIZE_DEFAULT})`
                );
            }

View on GitHub (pinned to 6b5ea01557)

Solutions

  1. Enter the exact PM2 process name (run 'pm2 list' on the target host to find it)
  2. Trim accidental whitespace when pasting the name
Defensive patterns

Strategy: validation

Validate before calling

if (monitor.type === "pm2" && !(monitor.system_service_name || "").trim()) throw new Error("PM2 process name is required");

Type guard

function hasPm2Name(monitor) { return monitor.type !== "pm2" || Boolean((monitor.system_service_name || "").trim()); }

Try / catch

try { monitor.validate(); await save(monitor); } catch (e) { /* surface e.message */ }

Prevention

When it happens

Trigger: Adding or editing a pm2 monitor with a blank or whitespace-only process name.

Common situations: User selected the PM2 type but did not fill in the process name; entry contains only spaces.

Related errors


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