{"record":{"id":"f13e2244d0009bc5","repo":"louislam/uptime-kuma","slug":"packet-size-must-be-between-ping-packet-size-min","errorCode":null,"errorMessage":"Packet size must be between ${PING_PACKET_SIZE_MIN} and ${PING_PACKET_SIZE_MAX} (default: ${PING_PACKET_SIZE_DEFAULT})","messagePattern":"Packet size must be between (.+?) and (.+?) \\(default: (.+?)\\)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/model/monitor.js","lineNumber":1712,"sourceCode":"            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            }\n\n            if (\n                this.ping_per_request_timeout &&\n                (this.ping_per_request_timeout < PING_PER_REQUEST_TIMEOUT_MIN ||\n                    this.ping_per_request_timeout > PING_PER_REQUEST_TIMEOUT_MAX)\n            ) {\n                throw new Error(\n                    `Per-ping timeout must be between ${PING_PER_REQUEST_TIMEOUT_MIN} and ${PING_PER_REQUEST_TIMEOUT_MAX} seconds (default: ${PING_PER_REQUEST_TIMEOUT_DEFAULT})`\n                );\n            }\n\n            if (this.ping_count && (this.ping_count < PING_COUNT_MIN || this.ping_count > PING_COUNT_MAX)) {\n                throw new Error(\n                    `Echo requests count must be between ${PING_COUNT_MIN} and ${PING_COUNT_MAX} (default: ${PING_COUNT_DEFAULT})`\n                );","sourceCodeStart":1694,"sourceCodeEnd":1730,"githubUrl":"https://github.com/louislam/uptime-kuma/blob/6b5ea0155793e666666745fb8d6fef1e829543a2/server/model/monitor.js#L1694-L1730","documentation":"Thrown by Monitor.validate() for type \"ping\" when packetSize is set and falls outside [PING_PACKET_SIZE_MIN=1, PING_PACKET_SIZE_MAX=65500] bytes. The range reflects the ICMP payload size accepted by the underlying ping binary; values outside it are rejected by the OS before any packet is sent.","triggerScenarios":"Save a ping monitor with packetSize=0 (falsy, skipped, so 0 is actually allowed-but-meaningless) or packetSize=-1, packetSize=70000, packetSize=\"abc\" coerced to NaN. The check fires whenever packetSize is truthy and outside the bounds.","commonSituations":"User enters packet size in KB or bits instead of bytes (e.g. 1024 expecting 1KB but wanting 65536). Copying a config from a tool that uses a different max (e.g. 8192). Negative numbers from a misconfigured slider.","solutions":["Set packetSize to a value between 1 and 65500, or omit it to use PING_PACKET_SIZE_DEFAULT.","If the value is entered in KB, multiply by 1024 and confirm it stays under 65500.","Cast the field to a Number before save to avoid a truthy string like \"70000\" bypassing numeric intent."],"exampleFix":"// before\n{ type: \"ping\", packetSize: 100000 }\n// after\n{ type: \"ping\", packetSize: 65500 }","handlingStrategy":"validation","validationCode":"const [MIN, MAX] = [1, 65500];\nfunction validPacketSize(v) {\n  const n = Number(v);\n  return !v || (Number.isInteger(n) && n >= MIN && n <= MAX);\n}","typeGuard":"function isPacketSize(n) {\n  return n == null || (typeof n === \"number\" && Number.isInteger(n) && n >= 1 && n <= 65500);\n}","tryCatchPattern":"try {\n  await bean.validate();\n} catch (e) {\n  if (/Packet size/.test(e.message)) return badRequest(\"packetSize must be 1..65500\");\n  throw e;\n}","preventionTips":["Label the field as bytes, not KB.","Clamp rather than reject in the UI: Math.min(65500, Math.max(1, n))."],"tags":["monitor","ping","validation","network","uptime-kuma"],"backgroundTag":null,"analyzedSha":"6b5ea0155793e666666745fb8d6fef1e829543a2","analyzedAt":"2026-08-12T23:42:12.959Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}