{"record":{"id":"51e095ae6adc8086","repo":"louislam/uptime-kuma","slug":"monitor-not-found-or-not-active","errorCode":null,"errorMessage":"Monitor not found or not active.","messagePattern":"Monitor not found or not active\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/routers/api-router.js","lineNumber":65,"sourceCode":"router.all(\"/api/push/:pushToken\", async (request, response) => {\n    try {\n        let pushToken = request.params.pushToken;\n        let msg = request.query.msg || \"OK\";\n        let ping = parseFloat(request.query.ping) || null;\n        let statusString = request.query.status || \"up\";\n        const statusFromParam = statusString === \"up\" ? UP : DOWN;\n\n        // Validate ping value - max 100 billion ms (~3.17 years)\n        // Fits safely in both BIGINT and FLOAT(20,2)\n        const MAX_PING_MS = 100000000000;\n        if (ping !== null && (ping < 0 || ping > MAX_PING_MS)) {\n            throw new Error(`Invalid ping value. Must be between 0 and ${MAX_PING_MS} ms.`);\n        }\n\n        let monitor = await R.findOne(\"monitor\", \" push_token = ? AND active = 1 \", [pushToken]);\n\n        if (!monitor) {\n            throw new Error(\"Monitor not found or not active.\");\n        }\n\n        const previousHeartbeat = await Monitor.getPreviousHeartbeat(monitor.id);\n\n        let isFirstBeat = true;\n\n        let bean = R.dispense(\"heartbeat\");\n        bean.time = R.isoDateTimeMillis(dayjs.utc());\n        bean.monitor_id = monitor.id;\n        bean.ping = ping;\n        bean.msg = msg;\n        bean.downCount = previousHeartbeat?.downCount || 0;\n\n        if (previousHeartbeat) {\n            isFirstBeat = false;\n            bean.duration = dayjs(bean.time).diff(dayjs(previousHeartbeat.time), \"second\");\n        }\n","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/louislam/uptime-kuma/blob/6b5ea0155793e666666745fb8d6fef1e829543a2/server/routers/api-router.js#L47-L83","documentation":"Thrown by the push endpoint when no `monitor` row matches the supplied `pushToken` AND `active = 1`. The token must correspond to an enabled push-type monitor. Returned to the caller as HTTP 404 with `{ok:false, msg}`.","triggerScenarios":"Calling /api/push/<token> with a wrong/typo'd token, a token for a monitor that was paused (active=0) or deleted, or a token copied from a different Uptime Kuma instance.","commonSituations":"Monitor was paused or disabled; monitor deleted and the push script still runs; token regenerated after a monitor edit; pointing the push agent at the wrong server/host.","solutions":["Re-copy the push URL from the monitor's settings in the UI and verify the token segment matches exactly.","Confirm the monitor exists and is active (not paused) in the dashboard.","Ensure the push script targets the correct Uptime Kuma instance/host.","If the monitor was deleted, recreate it and update the agent with the new token."],"exampleFix":"// before\nfetch(`${base}/api/push/${oldToken}?status=up`)\n\n// after\n// copy the full push URL from Monitor -> Settings -> Push URL, e.g.\nfetch(`${base}/api/push/${currentToken}?status=up&msg=OK&ping=${pingMs}`)","handlingStrategy":"fallback","validationCode":"// Confirm the token maps to an active monitor before relying on it\nconst m = await R.findOne('monitor', ' push_token = ? AND active = 1 ', [token]);\nif (!m) { log.warn('push token invalid/inactive'); return; }","typeGuard":"function looksLikePushToken(token) {\n  return typeof token === 'string' && token.length > 0 && /^[A-Za-z0-9_-]+$/.test(token);\n}","tryCatchPattern":null,"preventionTips":["Copy the push URL verbatim from the monitor's settings page.","Keep the monitor active (not paused) while pushing.","Point the push script at the correct Uptime Kuma host.","After deleting/recreating a monitor, update the agent with the new token."],"tags":["push-monitor","not-found","auth-token","monitor-active"],"backgroundTag":null,"analyzedSha":"6b5ea0155793e666666745fb8d6fef1e829543a2","analyzedAt":"2026-08-12T23:42:12.959Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}