louislam/uptime-kuma · error · Error

Per-ping timeout must be between ${PING_PER_REQUEST_TIMEOUT_

Error message

Per-ping timeout must be between ${PING_PER_REQUEST_TIMEOUT_MIN} and ${PING_PER_REQUEST_TIMEOUT_MAX} seconds (default: ${PING_PER_REQUEST_TIMEOUT_DEFAULT})

What it means

Thrown by Monitor.validate() for type "ping" when ping_per_request_timeout is set and outside [PING_PER_REQUEST_TIMEOUT_MIN=1, PING_PER_REQUEST_TIMEOUT_MAX=60] seconds. This is the per-echo-request (-W) deadline passed to ping, not the global monitor timeout.

Source

Thrown at server/model/monitor.js:1722

        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})`
                );
            }

            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
                ) {

View on GitHub (pinned to 6b5ea01557)

Solutions

  1. Set ping_per_request_timeout to an integer of seconds between 1 and 60, or omit it for the default.
  2. Ensure the value is less than or equal to the monitor's global timeout to avoid logical deadlocks.
  3. Convert any millisecond-based input by dividing by 1000.

Example fix

// before
{ type: "ping", ping_per_request_timeout: 3000 }
// after
{ type: "ping", ping_per_request_timeout: 3 }
Defensive patterns

Strategy: validation

Validate before calling

function validPerPingTimeout(v) {
  const n = Number(v);
  return !v || (Number.isInteger(n) && n >= 1 && n <= 60);
}

Type guard

function isPerPingTimeout(n) {
  return n == null || (typeof n === "number" && Number.isInteger(n) && n >= 1 && n <= 60);
}

Try / catch

try {
  await bean.validate();
} catch (e) {
  if (/Per-ping timeout/.test(e.message)) return badRequest("ping_per_request_timeout must be 1..60 seconds");
  throw e;
}

Prevention

When it happens

Trigger: Save a ping monitor with ping_per_request_timeout=0.5, =0, =90, or a negative value. Mixing units (entering milliseconds where seconds are expected).

Common situations: User confuses the per-ping timeout with the overall monitor timeout and enters the monitor's full timeout (e.g. 300s). Importing a config from a tool that expresses the value in milliseconds. Setting 0 expecting "no timeout".

Understand the failure class

Related errors


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