louislam/uptime-kuma · warning · Error

The maximum number of minutes is 1440

Error message

The maximum number of minutes is 1440

What it means

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.

Source

Thrown at server/uptime-calculator.js:568

            case DOWN:
            case PENDING:
                return DOWN;
        }
        throw new Error("Invalid status");
    }

    /**
     * @param {number} num the number of data points which are expected to be returned
     * @param {"day" | "hour" | "minute"} type the type of data which is expected to be returned
     * @returns {UptimeDataResult} UptimeDataResult
     * @throws {Error} The maximum number of minutes greater than 1440
     */
    getData(num, type = "day") {
        if (type === "hour" && num > 24 * 30) {
            throw new Error("The maximum number of hours is 720");
        }
        if (type === "minute" && num > 24 * 60) {
            throw new Error("The maximum number of minutes is 1440");
        }
        if (type === "day" && num > 365) {
            throw new Error("The maximum number of days is 365");
        }
        // Get the current time period key based on the type
        let key = this.getKey(this.getCurrentDate(), type);

        let total = {
            up: 0,
            down: 0,
        };

        let totalPing = 0;
        let endTimestamp;

        // Get the earliest timestamp of the required period based on the type
        switch (type) {
            case "day":

View on GitHub (pinned to 6b5ea01557)

Solutions

  1. Limit minutely requests to 1440 (24 hours); use hourly or daily type for longer windows.
  2. When calling chart-socket-handler with minute mode, ensure period*60 <= 1440 (period <= 24).
  3. Prefer the get24Hour() helper over hand-rolling 1440.
  4. Validate duration unit economics before submitting: minutes cover hours, hours cover days, days cover a year.

Example fix

// before
data = uptimeCalculator.getDataArray(period * 60, "minute"); // period=30 -> 1800 -> throws

// after
const minutes = Math.min(period * 60, 1440);
data = uptimeCalculator.getDataArray(minutes, "minute");
Defensive patterns

Strategy: validation

Validate before calling

if (type === "minute") num = Math.min(num, 1440);

Type guard

const withinMinuteLimit = (n) => typeof n === "number" && n > 0 && n <= 1440;

Try / catch

try { getData(n, "minute"); } catch (e) { if (/maximum number of minutes/.test(e.message)) getData(1440, "minute"); else throw e; }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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