louislam/uptime-kuma · error · Error
Packet size must be between ${PING_PACKET_SIZE_MIN} and ${PI
Error message
Packet size must be between ${PING_PACKET_SIZE_MIN} and ${PING_PACKET_SIZE_MAX} (default: ${PING_PACKET_SIZE_DEFAULT}) What it means
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.
Source
Thrown at server/model/monitor.js:1712
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})`
);
}
if (
this.ping_per_request_timeout &&
(this.ping_per_request_timeout < PING_PER_REQUEST_TIMEOUT_MIN ||
this.ping_per_request_timeout > PING_PER_REQUEST_TIMEOUT_MAX)
) {
throw new Error(
`Per-ping timeout must be between ${PING_PER_REQUEST_TIMEOUT_MIN} and ${PING_PER_REQUEST_TIMEOUT_MAX} seconds (default: ${PING_PER_REQUEST_TIMEOUT_DEFAULT})`
);
}
if (this.ping_count && (this.ping_count < PING_COUNT_MIN || this.ping_count > PING_COUNT_MAX)) {
throw new Error(
`Echo requests count must be between ${PING_COUNT_MIN} and ${PING_COUNT_MAX} (default: ${PING_COUNT_DEFAULT})`
);View on GitHub (pinned to 6b5ea01557)
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.
Example fix
// before
{ type: "ping", packetSize: 100000 }
// after
{ type: "ping", packetSize: 65500 } Defensive patterns
Strategy: validation
Validate before calling
const [MIN, MAX] = [1, 65500];
function validPacketSize(v) {
const n = Number(v);
return !v || (Number.isInteger(n) && n >= MIN && n <= MAX);
} Type guard
function isPacketSize(n) {
return n == null || (typeof n === "number" && Number.isInteger(n) && n >= 1 && n <= 65500);
} Try / catch
try {
await bean.validate();
} catch (e) {
if (/Packet size/.test(e.message)) return badRequest("packetSize must be 1..65500");
throw e;
} Prevention
- Label the field as bytes, not KB.
- Clamp rather than reject in the UI: Math.min(65500, Math.max(1, n)).
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Per-ping timeout must be between ${PING_PER_REQUEST_TIMEOUT_
- Echo requests count must be between ${PING_COUNT_MIN} and ${
- Timeout must be between ${PING_GLOBAL_TIMEOUT_MIN} and ${PIN
- No Resolver Servers specified. Please specify at least one r
- Service Name is required.
AI-assisted analysis of louislam/uptime-kuma@6b5ea01557 (2026-08-12).
Data as JSON: /api/errors/f13e2244d0009bc5.
Report an issue: GitHub.