louislam/uptime-kuma · error · Error
Echo requests count must be between ${PING_COUNT_MIN} and ${
Error message
Echo requests count must be between ${PING_COUNT_MIN} and ${PING_COUNT_MAX} (default: ${PING_COUNT_DEFAULT}) What it means
Thrown by Monitor.validate() for type "ping" when ping_count is set and outside [PING_COUNT_MIN=1, PING_COUNT_MAX=100]. This maps to the ping -c flag; 0 pings would never complete and >100 wastes time per heartbeat.
Source
Thrown at server/model/monitor.js:1728
// 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})`
);
}
if (this.timeout) {
const pingGlobalTimeout = Math.round(Number(this.timeout));
if (
pingGlobalTimeout < this.ping_per_request_timeout ||
pingGlobalTimeout < PING_GLOBAL_TIMEOUT_MIN ||
pingGlobalTimeout > PING_GLOBAL_TIMEOUT_MAX
) {
throw new Error(
`Timeout must be between ${PING_GLOBAL_TIMEOUT_MIN} and ${PING_GLOBAL_TIMEOUT_MAX} seconds (default: ${PING_GLOBAL_TIMEOUT_DEFAULT})`
);
}
this.timeout = pingGlobalTimeout;View on GitHub (pinned to 6b5ea01557)
Solutions
- Set ping_count to an integer between 1 and 100, or omit it for PING_COUNT_DEFAULT.
- Use a low count (1-3) for fast heartbeats; raise it only when averaging matters.
- Validate the field is a positive integer before submission.
Example fix
// before
{ type: "ping", ping_count: 0 }
// after
{ type: "ping", ping_count: 3 } Defensive patterns
Strategy: validation
Validate before calling
function validPingCount(v) {
const n = Number(v);
return !v || (Number.isInteger(n) && n >= 1 && n <= 100);
} Type guard
function isPingCount(n) {
return n == null || (typeof n === "number" && Number.isInteger(n) && n >= 1 && n <= 100);
} Try / catch
try {
await bean.validate();
} catch (e) {
if (/Echo requests count/.test(e.message)) return badRequest("ping_count must be 1..100");
throw e;
} Prevention
- Default to a small count (1-3) for heartbeat speed.
- Forbid 0 explicitly in the form; it is not 'infinite'.
When it happens
Trigger: Save a ping monitor with ping_count=0, ping_count=-5, ping_count=500, or a non-numeric truthy string. The check only runs when ping_count is truthy.
Common situations: User sets count to 0 thinking it means "ping forever" (it would hang the heartbeat). Aggressive polling configs that set a high count to smooth jitter. Negative values from form misconfiguration.
Related errors
- Packet size must be between ${PING_PACKET_SIZE_MIN} and ${PI
- Per-ping timeout must be between ${PING_PER_REQUEST_TIMEOUT_
- Timeout must be between ${PING_GLOBAL_TIMEOUT_MIN} and ${PIN
- Service Name is required.
- Invalid service name. Please use the internal Service Name (
AI-assisted analysis of louislam/uptime-kuma@6b5ea01557 (2026-08-12).
Data as JSON: /api/errors/c99c21d4386d6ede.
Report an issue: GitHub.