{"record":{"id":"c99c21d4386d6ede","repo":"louislam/uptime-kuma","slug":"echo-requests-count-must-be-between-ping-count-m","errorCode":null,"errorMessage":"Echo requests count must be between ${PING_COUNT_MIN} and ${PING_COUNT_MAX} (default: ${PING_COUNT_DEFAULT})","messagePattern":"Echo requests count must be between (.+?) and (.+?) \\(default: (.+?)\\)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/model/monitor.js","lineNumber":1728,"sourceCode":"            // 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                );\n            }\n\n            if (this.timeout) {\n                const pingGlobalTimeout = Math.round(Number(this.timeout));\n\n                if (\n                    pingGlobalTimeout < this.ping_per_request_timeout ||\n                    pingGlobalTimeout < PING_GLOBAL_TIMEOUT_MIN ||\n                    pingGlobalTimeout > PING_GLOBAL_TIMEOUT_MAX\n                ) {\n                    throw new Error(\n                        `Timeout must be between ${PING_GLOBAL_TIMEOUT_MIN} and ${PING_GLOBAL_TIMEOUT_MAX} seconds (default: ${PING_GLOBAL_TIMEOUT_DEFAULT})`\n                    );\n                }\n\n                this.timeout = pingGlobalTimeout;","sourceCodeStart":1710,"sourceCodeEnd":1746,"githubUrl":"https://github.com/louislam/uptime-kuma/blob/6b5ea0155793e666666745fb8d6fef1e829543a2/server/model/monitor.js#L1710-L1746","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\n{ type: \"ping\", ping_count: 0 }\n// after\n{ type: \"ping\", ping_count: 3 }","handlingStrategy":"validation","validationCode":"function validPingCount(v) {\n  const n = Number(v);\n  return !v || (Number.isInteger(n) && n >= 1 && n <= 100);\n}","typeGuard":"function isPingCount(n) {\n  return n == null || (typeof n === \"number\" && Number.isInteger(n) && n >= 1 && n <= 100);\n}","tryCatchPattern":"try {\n  await bean.validate();\n} catch (e) {\n  if (/Echo requests count/.test(e.message)) return badRequest(\"ping_count must be 1..100\");\n  throw e;\n}","preventionTips":["Default to a small count (1-3) for heartbeat speed.","Forbid 0 explicitly in the form; it is not 'infinite'."],"tags":["monitor","ping","validation","uptime-kuma"],"backgroundTag":null,"analyzedSha":"6b5ea0155793e666666745fb8d6fef1e829543a2","analyzedAt":"2026-08-12T23:42:12.959Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}