{"record":{"id":"c71ded529401054f","repo":"louislam/uptime-kuma","slug":"pm2-process-name-is-required","errorCode":null,"errorMessage":"PM2 process name is required.","messagePattern":"PM2 process name is required\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/model/monitor.js","lineNumber":1697,"sourceCode":"                JSON.parse(this.headers);\n            } catch (e) {\n                throw new Error(`Headers must be valid JSON: ${e.message}`);\n            }\n        }\n\n        if (this.accepted_statuscodes_json) {\n            try {\n                JSON.parse(this.accepted_statuscodes_json);\n            } catch (e) {\n                throw new Error(`Accepted status codes must be valid JSON: ${e.message}`);\n            }\n        }\n\n        if ([\"system-service\", \"pm2\"].includes(this.type)) {\n            this.system_service_name = (this.system_service_name || \"\").trim();\n\n            if (!this.system_service_name) {\n                throw new Error(this.type === \"pm2\" ? \"PM2 process name is required.\" : \"Service Name is required.\");\n            }\n        }\n\n        if (this.type === \"system-service\" && !/^[a-zA-Z0-9._\\-@]+$/.test(this.system_service_name)) {\n            throw new Error(\"Invalid service name. Please use the internal Service Name (no spaces).\");\n        }\n\n        if (this.type === \"pm2\" && /[\\u0000-\\u001F\\u007F]/.test(this.system_service_name)) {\n            throw new Error(\"Invalid PM2 process name.\");\n        }\n\n        if (this.type === \"ping\") {\n            // ping parameters validation\n            if (this.packetSize && (this.packetSize < PING_PACKET_SIZE_MIN || this.packetSize > PING_PACKET_SIZE_MAX)) {\n                throw new Error(\n                    `Packet size must be between ${PING_PACKET_SIZE_MIN} and ${PING_PACKET_SIZE_MAX} (default: ${PING_PACKET_SIZE_DEFAULT})`\n                );\n            }","sourceCodeStart":1679,"sourceCodeEnd":1715,"githubUrl":"https://github.com/louislam/uptime-kuma/blob/6b5ea0155793e666666745fb8d6fef1e829543a2/server/model/monitor.js#L1679-L1715","documentation":"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).","triggerScenarios":"Adding or editing a pm2 monitor with a blank or whitespace-only process name.","commonSituations":"User selected the PM2 type but did not fill in the process name; entry contains only spaces.","solutions":["Enter the exact PM2 process name (run 'pm2 list' on the target host to find it)","Trim accidental whitespace when pasting the name"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (monitor.type === \"pm2\" && !(monitor.system_service_name || \"\").trim()) throw new Error(\"PM2 process name is required\");","typeGuard":"function hasPm2Name(monitor) { return monitor.type !== \"pm2\" || Boolean((monitor.system_service_name || \"\").trim()); }","tryCatchPattern":"try { monitor.validate(); await save(monitor); } catch (e) { /* surface e.message */ }","preventionTips":["Run 'pm2 list' on the target host to copy the exact process name","Trim pasted names to avoid whitespace-only entries"],"tags":["pm2","validation","config"],"backgroundTag":null,"analyzedSha":"6b5ea0155793e666666745fb8d6fef1e829543a2","analyzedAt":"2026-08-12T23:42:12.959Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}