{"record":{"id":"0ec33f02ea923bea","repo":"louislam/uptime-kuma","slug":"interval-cannot-be-less-than-min-interval-second","errorCode":null,"errorMessage":"Interval cannot be less than ${MIN_INTERVAL_SECOND} seconds","messagePattern":"Interval cannot be less than (.+?) seconds","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/model/monitor.js","lineNumber":1627,"sourceCode":"            }\n        }\n\n        const parent = await Monitor.getParent(monitorID);\n        if (parent != null) {\n            return await Monitor.isUnderMaintenance(parent.id);\n        }\n\n        return false;\n    }\n\n    /**\n     * Validate monitor configuration\n     * @returns {void}\n     * @throws {Error} If validation fails\n     */\n    validate() {\n        if (this.interval < MIN_INTERVAL_SECOND) {\n            throw new Error(`Interval cannot be less than ${MIN_INTERVAL_SECOND} seconds`);\n        }\n\n        if (this.retryInterval < MIN_INTERVAL_SECOND) {\n            throw new Error(`Retry interval cannot be less than ${MIN_INTERVAL_SECOND} seconds`);\n        }\n\n        if (this.response_max_length !== undefined) {\n            if (this.response_max_length < 0) {\n                throw new Error(`Response max length cannot be less than 0`);\n            }\n\n            if (this.response_max_length > RESPONSE_BODY_LENGTH_MAX) {\n                throw new Error(`Response max length cannot be more than ${RESPONSE_BODY_LENGTH_MAX} bytes`);\n            }\n        }\n\n        // Validate JSON fields to prevent invalid JSON from being stored in database\n        if (this.kafkaProducerBrokers) {","sourceCodeStart":1609,"sourceCodeEnd":1645,"githubUrl":"https://github.com/louislam/uptime-kuma/blob/6b5ea0155793e666666745fb8d6fef1e829543a2/server/model/monitor.js#L1609-L1645","documentation":"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.","triggerScenarios":"Calling addMonitor/editMonitor with interval set to 0, a negative number, or otherwise below 1 second.","commonSituations":"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.","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"],"exampleFix":"// before\nmonitor.interval = 0;\n\n// after\nmonitor.interval = 20;","handlingStrategy":"validation","validationCode":"const MIN_INTERVAL_SECOND = 1;\nif (monitor.interval < MIN_INTERVAL_SECOND) throw new Error(`interval must be >= ${MIN_INTERVAL_SECOND}`);","typeGuard":"function isValidInterval(v) { return Number.isFinite(v) && v >= 1; }","tryCatchPattern":"// validate() throws on addMonitor/editMonitor; wrap the socket call\ntry { await socket.emit(\"addMonitor\", payload); } catch (e) { /* surface e.message */ }","preventionTips":["Clamp imported interval values to >=1 (ideally >=20) before import","Validate numeric monitor fields in any wrapper script before calling the API"],"tags":["validation","config","interval"],"backgroundTag":null,"analyzedSha":"6b5ea0155793e666666745fb8d6fef1e829543a2","analyzedAt":"2026-08-12T23:42:12.959Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}