apache/dolphinscheduler · warning · AlertResult

send telegram alert fail. %s

Error message

send telegram alert fail. %s

What it means

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.

Source

Thrown at dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-telegram/src/main/java/org/apache/dolphinscheduler/plugin/alert/telegram/TelegramSender.java:109

        }
    }

    /**
     * sendMessage
     *
     * @param alertData alert data
     * @return alert result
     * @see <a href="https://core.telegram.org/bots/api#sendmessage">telegram bot api</a>
     */
    AlertResult sendMessage(AlertData alertData) {
        AlertResult result;
        try {
            String resp = sendInvoke(alertData.getTitle(), alertData.getContent());
            result = parseRespToResult(resp);
        } catch (Exception e) {
            log.warn("send telegram alert msg exception : {}", e.getMessage());
            result = new AlertResult();
            result.setSuccess(false);
            result.setMessage(String.format("send telegram alert fail. %s", e.getMessage()));
        }
        return result;
    }

    private AlertResult parseRespToResult(String resp) {
        AlertResult result = new AlertResult();
        result.setSuccess(false);
        if (null == resp || resp.isEmpty()) {
            result.setMessage("send telegram msg error. telegram server resp is empty");
            return result;
        }
        TelegramSendMsgResponse response = JSONUtils.parseObject(resp, TelegramSendMsgResponse.class);
        if (null == response) {
            result.setMessage("send telegram msg fail.");
            return result;
        }
        if (!response.isOk()) {

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Read the %s detail in the message for the real cause (e.g. 'Unauthorized' means bad token).
  2. Verify the Telegram bot token and chat_id; send /start to the bot from the target chat.
  3. Test network/proxy access to https://api.telegram.org from the alert server host.
  4. Check webhook/proxy plugin settings in the Telegram alert plugin configuration.

Example fix

// before
token: 123456:ABC-old  // revoked -> 'Unauthorized'
// after: create a new bot with @BotFather and update the token
token: 789012:XYZ-new  // and send /start to the bot in the target chat
Defensive patterns

Strategy: try-catch

Validate before calling

# pre-flight check of the Telegram bot
import requests
token = config['token']; chat_id = config['chat_id']
r = requests.get(f'https://api.telegram.org/bot{token}/getMe', timeout=5)
r.raise_for_status()
r2 = requests.get(f'https://api.telegram.org/bot{token}/sendMessage', params={'chat_id': chat_id, 'text': 'ping'}, timeout=5)
r2.raise_for_status()

Try / catch

AlertResult r = telegramSender.sendMessage(alertData);
if (!r.isSuccess()) { log.warn("telegram alert failed: {}", r.getMessage()); fallbackAlertChannel(alertData); }

Prevention

When it happens

Trigger: sendInvoke fails (invalid bot token, unreachable api.telegram.org, HTTP error) or parseRespToResult throws, producing an AlertResult with success=false containing the exception message.

Common situations: 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).

Understand the failure class

Background: "API request failed": what wrapped HTTP errors from external APIs mean and how to find the real cause — this error's family across 29 libraries.

Related errors


AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06). Data as JSON: /api/errors/4577b004e98798e1. Report an issue: GitHub.