{"record":{"id":"3b5c51caa7d84b95","repo":"louislam/uptime-kuma","slug":"maintenance-not-found","errorCode":null,"errorMessage":"Maintenance not found","messagePattern":"Maintenance not found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"server/socket-handlers/maintenance-socket-handler.js","lineNumber":263,"sourceCode":"            await server.sendMaintenanceList(socket);\n        } catch (e) {\n            callback({\n                ok: false,\n                msg: e.message,\n            });\n        }\n    });\n\n    socket.on(\"pauseMaintenance\", async (maintenanceID, callback) => {\n        try {\n            checkLogin(socket);\n\n            log.debug(\"maintenance\", `Pause Maintenance: ${maintenanceID} User ID: ${socket.userID}`);\n\n            let maintenance = server.getMaintenance(maintenanceID);\n\n            if (!maintenance) {\n                throw new Error(\"Maintenance not found\");\n            }\n\n            maintenance.active = false;\n            await R.store(maintenance);\n            maintenance.stop();\n\n            apicache.clear();\n\n            callback({\n                ok: true,\n                msg: \"successPaused\",\n                msgi18n: true,\n            });\n\n            await server.sendMaintenanceList(socket);\n        } catch (e) {\n            callback({\n                ok: false,","sourceCodeStart":245,"sourceCodeEnd":281,"githubUrl":"https://github.com/louislam/uptime-kuma/blob/6b5ea0155793e666666745fb8d6fef1e829543a2/server/socket-handlers/maintenance-socket-handler.js#L245-L281","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Refresh the maintenance list (sendMaintenanceList) and pause only IDs present in the current list.","Ensure maintenanceID is passed as the same type (numeric) used as the map key.","Treat the not-found case in the UI as 'already removed' rather than retrying."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (!maintenanceList.some(m => Number(m.id) === Number(maintenanceID))) {\n  throw new Error(\"Maintenance not found\");\n}\nsocket.emit(\"pauseMaintenance\", maintenanceID, cb);","typeGuard":"function maintenanceExists(id, list) {\n  return Array.isArray(list) && list.some(m => Number(m.id) === Number(id));\n}","tryCatchPattern":"try { await emitAsync(\"pauseMaintenance\", id, cb); }\ncatch (e) { if (/not found/.test(e.message)) removeMaintenanceFromUI(id); else throw e; }","preventionTips":["Refresh the maintenance list after server restart.","Pass maintenanceID as the key type used by the server.","Disable pause for IDs no longer in the list."],"tags":["maintenance","not-found","socket-io","validation"],"backgroundTag":null,"analyzedSha":"6b5ea0155793e666666745fb8d6fef1e829543a2","analyzedAt":"2026-08-12T23:42:12.959Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}