{"record":{"id":"46ac74dd90341b99","repo":"louislam/uptime-kuma","slug":"the-maximum-number-of-minutes-is-1440","errorCode":null,"errorMessage":"The maximum number of minutes is 1440","messagePattern":"The maximum number of minutes is 1440","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"server/uptime-calculator.js","lineNumber":568,"sourceCode":"            case DOWN:\n            case PENDING:\n                return DOWN;\n        }\n        throw new Error(\"Invalid status\");\n    }\n\n    /**\n     * @param {number} num the number of data points which are expected to be returned\n     * @param {\"day\" | \"hour\" | \"minute\"} type the type of data which is expected to be returned\n     * @returns {UptimeDataResult} UptimeDataResult\n     * @throws {Error} The maximum number of minutes greater than 1440\n     */\n    getData(num, type = \"day\") {\n        if (type === \"hour\" && num > 24 * 30) {\n            throw new Error(\"The maximum number of hours is 720\");\n        }\n        if (type === \"minute\" && num > 24 * 60) {\n            throw new Error(\"The maximum number of minutes is 1440\");\n        }\n        if (type === \"day\" && num > 365) {\n            throw new Error(\"The maximum number of days is 365\");\n        }\n        // Get the current time period key based on the type\n        let key = this.getKey(this.getCurrentDate(), type);\n\n        let total = {\n            up: 0,\n            down: 0,\n        };\n\n        let totalPing = 0;\n        let endTimestamp;\n\n        // Get the earliest timestamp of the required period based on the type\n        switch (type) {\n            case \"day\":","sourceCodeStart":550,"sourceCodeEnd":586,"githubUrl":"https://github.com/louislam/uptime-kuma/blob/6b5ea0155793e666666745fb8d6fef1e829543a2/server/uptime-calculator.js#L550-L586","documentation":"Thrown by UptimeCalculator.getData(num, type) when `type === \"minute\" && num > 24 * 60` (1440). Bounds minutely data because only 24 hours of per-minute stats are kept (`statMinutelyKeepHour = 24`). Requesting more would underflow the available history.","triggerScenarios":"Direct getData(num, \"minute\") with num > 1440, or via getDataByDuration(\"Nm\") with N > 1440. The get24Hour() convenience method calls getData(1440, \"minute\") exactly at the limit and does NOT throw. badge duration with explicit \"m\" unit exceeding 1440.","commonSituations":"Custom dashboard requesting minute-resolution beyond a day; badge URL `/api/badge/:id/ping/2000m`; misinterpreting the duration number as seconds or as a different unit; chart client passing period*60 that overflows.","solutions":["Limit minutely requests to 1440 (24 hours); use hourly or daily type for longer windows.","When calling chart-socket-handler with minute mode, ensure period*60 <= 1440 (period <= 24).","Prefer the get24Hour() helper over hand-rolling 1440.","Validate duration unit economics before submitting: minutes cover hours, hours cover days, days cover a year."],"exampleFix":"// before\ndata = uptimeCalculator.getDataArray(period * 60, \"minute\"); // period=30 -> 1800 -> throws\n\n// after\nconst minutes = Math.min(period * 60, 1440);\ndata = uptimeCalculator.getDataArray(minutes, \"minute\");","handlingStrategy":"validation","validationCode":"if (type === \"minute\") num = Math.min(num, 1440);","typeGuard":"const withinMinuteLimit = (n) => typeof n === \"number\" && n > 0 && n <= 1440;","tryCatchPattern":"try { getData(n, \"minute\"); } catch (e) { if (/maximum number of minutes/.test(e.message)) getData(1440, \"minute\"); else throw e; }","preventionTips":["Cap minute-resolution requests to 24 hours.","In chart minute mode, keep period <= 24.","Use get24Hour() instead of hard-coding 1440."],"tags":["uptime-calculator","limits","chart","validation","uptime-kuma"],"backgroundTag":null,"analyzedSha":"6b5ea0155793e666666745fb8d6fef1e829543a2","analyzedAt":"2026-08-12T23:42:12.959Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}