{"record":{"id":"4577b004e98798e1","repo":"apache/dolphinscheduler","slug":"send-telegram-alert-fail-s","errorCode":null,"errorMessage":"send telegram alert fail. %s","messagePattern":"send telegram alert fail\\. (.+?)","errorType":"exception","errorClass":"AlertResult","httpStatus":null,"severity":"warning","filePath":"dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-telegram/src/main/java/org/apache/dolphinscheduler/plugin/alert/telegram/TelegramSender.java","lineNumber":109,"sourceCode":"        }\n    }\n\n    /**\n     * sendMessage\n     *\n     * @param alertData alert data\n     * @return alert result\n     * @see <a href=\"https://core.telegram.org/bots/api#sendmessage\">telegram bot api</a>\n     */\n    AlertResult sendMessage(AlertData alertData) {\n        AlertResult result;\n        try {\n            String resp = sendInvoke(alertData.getTitle(), alertData.getContent());\n            result = parseRespToResult(resp);\n        } catch (Exception e) {\n            log.warn(\"send telegram alert msg exception : {}\", e.getMessage());\n            result = new AlertResult();\n            result.setSuccess(false);\n            result.setMessage(String.format(\"send telegram alert fail. %s\", e.getMessage()));\n        }\n        return result;\n    }\n\n    private AlertResult parseRespToResult(String resp) {\n        AlertResult result = new AlertResult();\n        result.setSuccess(false);\n        if (null == resp || resp.isEmpty()) {\n            result.setMessage(\"send telegram msg error. telegram server resp is empty\");\n            return result;\n        }\n        TelegramSendMsgResponse response = JSONUtils.parseObject(resp, TelegramSendMsgResponse.class);\n        if (null == response) {\n            result.setMessage(\"send telegram msg fail.\");\n            return result;\n        }\n        if (!response.isOk()) {","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-telegram/src/main/java/org/apache/dolphinscheduler/plugin/alert/telegram/TelegramSender.java#L91-L127","documentation":"TelegramSender.sendMessage catches any exception while invoking the Telegram API or parsing its response and returns an unsuccessful AlertResult with message 'send telegram alert fail. %s'. It never rethrows; the alert simply reports failure with the underlying exception message.","triggerScenarios":"sendInvoke fails (invalid bot token, unreachable api.telegram.org, HTTP error) or parseRespToResult throws, producing an AlertResult with success=false containing the exception message.","commonSituations":"Wrong/revoked bot token, chat_id not set or the bot never started a chat with the user, corporate proxy/firewall blocking telegram.org, Telegram API 4xx responses (e.g. 400 bad chat_id).","solutions":["Read the %s detail in the message for the real cause (e.g. 'Unauthorized' means bad token).","Verify the Telegram bot token and chat_id; send /start to the bot from the target chat.","Test network/proxy access to https://api.telegram.org from the alert server host.","Check webhook/proxy plugin settings in the Telegram alert plugin configuration."],"exampleFix":"// before\ntoken: 123456:ABC-old  // revoked -> 'Unauthorized'\n// after: create a new bot with @BotFather and update the token\ntoken: 789012:XYZ-new  // and send /start to the bot in the target chat","handlingStrategy":"try-catch","validationCode":"# pre-flight check of the Telegram bot\nimport requests\ntoken = config['token']; chat_id = config['chat_id']\nr = requests.get(f'https://api.telegram.org/bot{token}/getMe', timeout=5)\nr.raise_for_status()\nr2 = requests.get(f'https://api.telegram.org/bot{token}/sendMessage', params={'chat_id': chat_id, 'text': 'ping'}, timeout=5)\nr2.raise_for_status()","typeGuard":null,"tryCatchPattern":"AlertResult r = telegramSender.sendMessage(alertData);\nif (!r.isSuccess()) { log.warn(\"telegram alert failed: {}\", r.getMessage()); fallbackAlertChannel(alertData); }","preventionTips":["Verify bot token with getMe after rotation","Always /start the bot in the target chat","Whitelist api.telegram.org on the alert server egress","Configure a secondary alert channel as fallback"],"tags":["telegram","alert","network","http"],"backgroundTag":"api-request-failed","analyzedSha":"02eac45a1b6676e639fcbfb4be2243de5771b05d","analyzedAt":"2026-09-06T17:43:00.555Z","contentChangedAt":"2026-09-06T17:43:00.555Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}