louislam/uptime-kuma · error · Error
Interval cannot be less than ${MIN_INTERVAL_SECOND} seconds
Error message
Interval cannot be less than ${MIN_INTERVAL_SECOND} seconds What it means
validate() rejects monitor.interval below MIN_INTERVAL_SECOND (currently 1). validate() runs on addMonitor (server.js:787) and editMonitor (server.js:964) via the socket API, so the error surfaces at monitor save time.
Source
Thrown at server/model/monitor.js:1627
}
}
const parent = await Monitor.getParent(monitorID);
if (parent != null) {
return await Monitor.isUnderMaintenance(parent.id);
}
return false;
}
/**
* Validate monitor configuration
* @returns {void}
* @throws {Error} If validation fails
*/
validate() {
if (this.interval < MIN_INTERVAL_SECOND) {
throw new Error(`Interval cannot be less than ${MIN_INTERVAL_SECOND} seconds`);
}
if (this.retryInterval < MIN_INTERVAL_SECOND) {
throw new Error(`Retry interval cannot be less than ${MIN_INTERVAL_SECOND} seconds`);
}
if (this.response_max_length !== undefined) {
if (this.response_max_length < 0) {
throw new Error(`Response max length cannot be less than 0`);
}
if (this.response_max_length > RESPONSE_BODY_LENGTH_MAX) {
throw new Error(`Response max length cannot be more than ${RESPONSE_BODY_LENGTH_MAX} bytes`);
}
}
// Validate JSON fields to prevent invalid JSON from being stored in database
if (this.kafkaProducerBrokers) {View on GitHub (pinned to 6b5ea01557)
Solutions
- Set interval to at least MIN_INTERVAL_SECOND (1s); in practice prefer >=20s to avoid hammering targets
- If importing from a fork with different limits, clamp values to >=1 before import
Example fix
// before monitor.interval = 0; // after monitor.interval = 20;
Defensive patterns
Strategy: validation
Validate before calling
const MIN_INTERVAL_SECOND = 1;
if (monitor.interval < MIN_INTERVAL_SECOND) throw new Error(`interval must be >= ${MIN_INTERVAL_SECOND}`); Type guard
function isValidInterval(v) { return Number.isFinite(v) && v >= 1; } Try / catch
// validate() throws on addMonitor/editMonitor; wrap the socket call
try { await socket.emit("addMonitor", payload); } catch (e) { /* surface e.message */ } Prevention
- Clamp imported interval values to >=1 (ideally >=20) before import
- Validate numeric monitor fields in any wrapper script before calling the API
When it happens
Trigger: Calling addMonitor/editMonitor with interval set to 0, a negative number, or otherwise below 1 second.
Common situations: Script/API creating a monitor with an invalid interval; importing a backup from a fork that permitted sub-second intervals; UI race producing an empty value.
Related errors
- Retry interval cannot be less than ${MIN_INTERVAL_SECOND} se
- Response max length cannot be less than 0
- Response max length cannot be more than ${RESPONSE_BODY_LENG
- Kafka Producer Brokers must be valid JSON: ${e.message}
- Kafka Producer SASL Options must be valid JSON: ${e.message}
AI-assisted analysis of louislam/uptime-kuma@6b5ea01557 (2026-08-12).
Data as JSON: /api/errors/0ec33f02ea923bea.
Report an issue: GitHub.