louislam/uptime-kuma · warning · Error

Maintenance not found

Error message

Maintenance not found

What it means

Thrown by the pauseMaintenance handler when server.getMaintenance(maintenanceID) returns null (the id is absent from the in-memory maintenanceList map). It guards against pausing a non-existent or unloaded maintenance window.

Source

Thrown at server/socket-handlers/maintenance-socket-handler.js:263

            await server.sendMaintenanceList(socket);
        } catch (e) {
            callback({
                ok: false,
                msg: e.message,
            });
        }
    });

    socket.on("pauseMaintenance", async (maintenanceID, callback) => {
        try {
            checkLogin(socket);

            log.debug("maintenance", `Pause Maintenance: ${maintenanceID} User ID: ${socket.userID}`);

            let maintenance = server.getMaintenance(maintenanceID);

            if (!maintenance) {
                throw new Error("Maintenance not found");
            }

            maintenance.active = false;
            await R.store(maintenance);
            maintenance.stop();

            apicache.clear();

            callback({
                ok: true,
                msg: "successPaused",
                msgi18n: true,
            });

            await server.sendMaintenanceList(socket);
        } catch (e) {
            callback({
                ok: false,

View on GitHub (pinned to 6b5ea01557)

Solutions

  1. Refresh the maintenance list (sendMaintenanceList) and pause only IDs present in the current list.
  2. Ensure maintenanceID is passed as the same type (numeric) used as the map key.
  3. Treat the not-found case in the UI as 'already removed' rather than retrying.
Defensive patterns

Strategy: validation

Validate before calling

if (!maintenanceList.some(m => Number(m.id) === Number(maintenanceID))) {
  throw new Error("Maintenance not found");
}
socket.emit("pauseMaintenance", maintenanceID, cb);

Type guard

function maintenanceExists(id, list) {
  return Array.isArray(list) && list.some(m => Number(m.id) === Number(id));
}

Try / catch

try { await emitAsync("pauseMaintenance", id, cb); }
catch (e) { if (/not found/.test(e.message)) removeMaintenanceFromUI(id); else throw e; }

Prevention

When it happens

Trigger: Client emits 'pauseMaintenance' with an ID that does not exist in UptimeKumaServer.maintenanceList—either deleted, never loaded, or not owned by this user (since the list is per-user filtered).

Common situations: Stale client holding a maintenance id after server restart cleared the in-memory list; maintenance was deleted in another session; client sends a stringified id that does not match the numeric keys.

Related errors


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