{"record":{"id":"596b31e0a543db2d","repo":"louislam/uptime-kuma","slug":"password-is-too-weak-please-use-a-stronger-passwo","errorCode":null,"errorMessage":"Password is too weak, please use a stronger password.","messagePattern":"Password is too weak, please use a stronger password\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"info","filePath":"extra/reset-password.js","lineNumber":50,"sourceCode":"                throw new Error(\"user not found, have you installed?\");\n            }\n\n            console.log(\"Found user: \" + user.username);\n\n            while (true) {\n                let password;\n                let confirmPassword;\n\n                // When called with \"--new-password\" argument for unattended modification (e.g. npm run reset-password -- --new_password=secret)\n                if (\"new-password\" in args) {\n                    console.log(\"Using password from argument\");\n                    console.warn(\n                        \"\\x1b[31m%s\\x1b[0m\",\n                        \"Warning: the password might be stored, in plain text, in your shell's history\"\n                    );\n                    password = confirmPassword = args[\"new-password\"] + \"\";\n                    if (passwordStrength(password).value === \"Too weak\") {\n                        throw new Error(\"Password is too weak, please use a stronger password.\");\n                    }\n                } else {\n                    password = await question(\"New Password: \");\n                    if (passwordStrength(password).value === \"Too weak\") {\n                        console.log(\"Password is too weak, please try again.\");\n                        continue;\n                    }\n                    confirmPassword = await question(\"Confirm New Password: \");\n                }\n\n                if (password === confirmPassword) {\n                    if (!(\"dry-run\" in args)) {\n                        await User.resetPassword(user.id, password);\n\n                        // Reset all sessions by reset jwt secret\n                        await initJWTSecret();\n\n                        // Disconnect all other socket clients of the user","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/louislam/uptime-kuma/blob/6b5ea0155793e666666745fb8d6fef1e829543a2/extra/reset-password.js#L32-L68","documentation":"Thrown locally by autoGetTelegramChatID (Telegram.vue:195) when the newest entry in Telegram's bot getUpdates response is an update type the handler does not understand. The code only inspects update.channel_post and update.message, so if the most recent update is a callback_query, edited_message, my_chat_member, chat_member, poll, poll_answer, etc., both branches are skipped and the else branch throws. The surrounding try/catch turns it into a toast, so it is a guided user message, not a runtime failure.","triggerScenarios":"Clicking 'Auto Get' next to telegram-chat-id after the bot's latest update is not a plain message or channel_post. Typical last-update shapes that trigger this: my_chat_member (bot added/removed as admin), edited_message (user edited a prior text), callback_query (user tapped an inline button), chat_member (member status change), or a poll update. res.data.result is non-empty but the top item has neither .message nor .channel_post.","commonSituations":"Telegram group adds the bot and emits my_chat_member, which lands above the earlier /start message. A user edits or pins a message, pushing edited_message on top. A prior getUpdates with offset, or an active webhook, has consumed the genuine messages leaving only status updates. Long-lived bots whose update queue drifted into non-message events.","solutions":["Send a fresh /start or any text to the bot (or post in the target channel where the bot is a member), then click 'Auto Get' so a message/channel_post is the newest update.","Drain the update queue by calling getUpdates with offset set past the last update_id, or delete the active webhook, then retry Auto Get.","Broaden the handler to also read chat.id from edited_message.chat, my_chat_member.chat, and callback_query.message.chat so other update types still resolve an ID.","Iterate res.data.result from newest to oldest and use the first update that exposes any chat object, rather than only the single last entry."],"exampleFix":"// before\nif (update.channel_post) {\n    this.$parent.notification.telegramChatID = update.channel_post.chat.id;\n} else if (update.message) {\n    this.$parent.notification.telegramChatID = update.message.chat.id;\n} else {\n    throw new Error(this.$t(\"chatIDNotFound\"));\n}\n\n// after: accept any update shape that carries a chat id\nlet chatId =\n    update.channel_post?.chat.id ??\n    update.message?.chat.id ??\n    update.edited_message?.chat.id ??\n    update.my_chat_member?.chat.id ??\n    update.callback_query?.message?.chat.id;\n\nif (chatId != null) {\n    this.$parent.notification.telegramChatID = chatId;\n} else {\n    throw new Error(this.$t(\"chatIDNotFound\"));\n}","handlingStrategy":"type-guard","validationCode":"// Confirm a token (and a reachable server URL) exist before polling\nif (!this.$parent.notification.telegramBotToken || !this.$parent.notification.telegramBotToken.trim()) {\n    this.$root.toastError(this.$t(\"telegramBotTokenRequired\"));\n    return;\n}\nif (!this.$parent.notification.telegramServerUrl) {\n    this.$root.toastError(this.$t(\"telegramServerUrlRequired\"));\n    return;\n}","typeGuard":"// Narrow a Telegram update to one that exposes a chat.id across the common update types\nfunction hasTelegramChatId(update) {\n    return Boolean(\n        update?.channel_post?.chat?.id ??\n        update?.message?.chat?.id ??\n        update?.edited_message?.chat?.id ??\n        update?.my_chat_member?.chat?.id ??\n        update?.callback_query?.message?.chat?.id\n    );\n}\n\nconst update = res.data.result[res.data.result.length - 1];\nif (!hasTelegramChatId(update)) {\n    throw new Error(this.$t(\"chatIDNotFound\"));\n}","tryCatchPattern":"try {\n    const res = await axios.get(this.telegramGetUpdatesURL(\"withToken\"));\n    const update = res.data?.result?.[res.data.result.length - 1];\n    if (!hasTelegramChatId(update)) throw new Error(this.$t(\"chatIDNotFound\"));\n    this.$parent.notification.telegramChatID =\n        update.channel_post?.chat.id ?? update.message?.chat.id;\n} catch (error) {\n    const msg = error.response\n        ? `${this.$t(\"chatIDNotFound\")} (HTTP ${error.response.status})`\n        : error.message;\n    this.$root.toastError(msg);\n}","preventionTips":["Send /start or a plain text to the bot right before clicking 'Auto Get'.","When adding the bot to a group/channel for auto-detect, send a follow-up message so my_chat_member is not the newest update.","Drain the update queue (getUpdates with offset, or deleteWebhook) before retrying in polluted environments.","Add type-narrowing for edited_message / my_chat_member / callback_query so unhandled update types no longer throw."],"tags":["telegram","bot-api","getupdates","vue","notification-provider","user-facing"],"backgroundTag":null,"analyzedSha":"6b5ea0155793e666666745fb8d6fef1e829543a2","analyzedAt":"2026-08-12T23:42:12.959Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}