Most/Docs

Most failures: messages/telegram

Every functionality most-server runs and every way each can fail, from the server's own failure catalogue.

How a refusal reads#

most-server answers a request it refuses with the cause's HTTP status and a body naming the step that failed and why (`detail`), and, under `error`, the cause (`<functionality>.<cause>`), its fix (`remedy`), its code and whether sending it again can help; a refusal of the request itself (a 4xx) also says what it observed of the request. A failure of the host (a 5xx) keeps what it observed in the service's log line of the same request. A refused start prints what failed, the fix and the cause on stderr and exits with the cause's status: 2 for a usage error, 69 when retrying unchanged can help, 1 otherwise.

This page is generated from the failure catalogue the running most-server prints (`most-server errors list`); a cause whose test cannot run on a developer's machine is listed in the Most repository's tests/untested-causes/ with why.

Refusal body
{"detail": "<the step that failed>: <why>",
 "error": {"code": "config", "service": "backend", "impact": "messaging",
           "retryable": false, "cause": "<functionality>.<cause>",
           "remedy": "<the fix>", "observed": "<the state observed, for a 4xx>"}}

most.telegram.send#

Send text to one Telegram chat through the operator's bot over the Bot API, and keep the chat and the message with what Telegram stored.

Started through: `POST /v3/chats (preferred_service Telegram)`, `POST /v3/chats/{chat_id}/messages on a Telegram chat`, `POST /v3/chats/{chat_id}/typing on a Telegram chat`.

Uses: `most.core.storage`.

  • `most.telegram.send.recipient-count` — HTTP 400, exit 2. creating a Telegram chat: a Telegram message goes to exactly one chat id. Observed: to names {count} recipients. Fix: create one chat per Telegram chat id. Provoked by `tests/telegram/refusal.rs::a_chat_with_two_recipients_is_refused`.
  • `most.telegram.send.chat-id-invalid` — HTTP 400, exit 2. addressing a Telegram chat: a Telegram recipient is the integer Telegram gives a chat; a username or a phone number is not one. Observed: the recipient is {recipient}: {error}. Fix: name the chat id, which a chat that has started a conversation with the bot carries in its updates. Provoked by `tests/telegram/refusal.rs::a_recipient_that_is_not_a_chat_id_is_refused`.
  • `most.telegram.send.part-not-text` — HTTP 400, exit 2. composing a Telegram message: this channel sends text parts only. Observed: part {index} is {kind}. Fix: send text parts on Telegram, or send media on an iMessage chat. Provoked by `tests/telegram/refusal.rs::a_part_that_is_not_text_is_refused`.
  • `most.telegram.send.text-missing` — HTTP 400, exit 2. composing a Telegram message: the message carries no text part with a value. Observed: {parts} part(s), none of them text with a value. Fix: send at least one part of type text with a non-empty value. Provoked by `tests/telegram/refusal.rs::a_message_without_text_is_refused`.
  • `most.telegram.send.chat-id-unstored` — HTTP 403, exit 1. sending on chat {chat}: the stored chat keeps no Telegram chat id, so there is nobody to send to. Observed: chat {chat} is stored with no backend_ref. Fix: start a new chat with POST /v3/chats naming the Telegram chat id; this one cannot be sent on. Provoked by `tests/telegram/refusal.rs::a_chat_stored_without_a_chat_id_is_refused`.
  • `most.telegram.send.refused` — HTTP 403, exit 1. calling Telegram's {method}: Telegram refused the call, in its own words. Observed: Telegram answered {code}: {description}. Fix: act on Telegram's words: 401 is a bot token Telegram does not hold, 403 a chat that blocked the bot or never started it, 400 a chat Telegram does not know, 409 on getUpdates a webhook set on the bot (deleteWebhook removes it) or a second most-server reading the same bot's updates. Provoked by `tests/telegram/refusal.rs::a_token_no_bot_holds_is_refused_in_telegrams_words`.
  • `most.telegram.send.rate-limited` — HTTP 429, exit 69, and sending it again can help. calling Telegram's {method}: Telegram is limiting how fast this bot sends. Observed: Telegram answered 429: {description}; it says to retry after {retry_after} s. Fix: send again after the time Telegram states; Most does not wait and resend on its own. Provoked by `tests/telegram/refusal.rs::a_rate_limit_keeps_the_time_telegram_states`.
  • `most.telegram.send.unreachable` — HTTP 503, exit 69, and sending it again can help. calling Telegram's {method}: no answer came back from Telegram. Observed: {error}. Fix: check that this host reaches api.telegram.org, then send again. Provoked by `tests/telegram/refusal.rs::an_unreachable_bot_api_is_named`.
  • `most.telegram.send.unreadable` — HTTP 503, exit 1. calling Telegram's {method}: the answer is not the Bot API's answer. Observed: HTTP {status}: {error}. Fix: check that the configured Bot API origin is Telegram's or a Bot API server of the operator's. Provoked by `tests/telegram/refusal.rs::an_answer_that_is_not_the_bot_api_is_named`.
  • `most.telegram.send.token-not-text` — HTTP 503, exit 1. reading the Telegram bot token {reference} names: a bot token is text, and the secret holds bytes that are not UTF-8. Observed: {bytes} byte(s), not UTF-8 from byte {at}. Fix: store the token BotFather issued, as it shows it, in {reference}. Provoked by `tests/telegram/refusal.rs::a_token_that_is_not_text_is_refused`.
  • `most.telegram.send.token-blank` — HTTP 503, exit 1. reading the Telegram bot token {reference} names: the secret holds nothing but whitespace, and a blank token names no bot. Observed: {bytes} byte(s), all whitespace. Fix: store the token BotFather issued, as it shows it, in {reference}. Provoked by `tests/telegram/refusal.rs::a_token_of_only_whitespace_is_refused`.

most.telegram.receive#

Read the operator's bot's updates, keep each text message on the Most chat of its Telegram chat id, and send it to that chat id's subscribers as message.received.

Started through: `the Telegram bot's updates, read while most-server runs`.

Uses: `most.telegram.send`, `most.core.storage`, `most.core.webhook_delivery`.

  • `most.telegram.receive.poll-wait-invalid` — HTTP 503, exit 1. reading MOST_TELEGRAM_POLL_WAIT_SECONDS: the time each getUpdates request is held open is a whole number of seconds above zero; zero would ask Telegram in a tight loop. Observed: MOST_TELEGRAM_POLL_WAIT_SECONDS is {value}: {error}. Fix: set MOST_TELEGRAM_POLL_WAIT_SECONDS to a whole number of seconds above zero, or leave it unset to send without receiving, and start most-server again. Provoked by `tests/telegram/refusal.rs::a_poll_wait_of_zero_is_refused`.
  • `most.telegram.receive.inbound-not-text` — HTTP 403, exit 1. receiving Telegram message {message} on chat {chat}: the message carries no text (a photo, a sticker, a file), and the Telegram channel receives text only. Observed: message {message} has no text. Fix: send text to the bot; receiving other kinds is not built (docs/messages/telegram.md). Provoked by `tests/telegram/send-and-receive.mjs::a_message_without_text_is_logged`.
  • `most.telegram.receive.date-unreadable` — HTTP 403, exit 1. reading when Telegram message {message} on chat {chat} was sent: Telegram writes a message's date as Unix seconds, and this one is outside the instants a time can hold, so the message is received without the time it was sent. Observed: date is {date}. Fix: nothing in Most: report the message to Telegram; the message itself is kept and sent on. Provoked by `tests/telegram/send-and-receive.mjs::a_message_with_an_unreadable_date_is_received_without_it`.
  • `most.telegram.receive.subscription-unsigned` — HTTP 403, exit 1. sending Telegram message {message} to subscription {subscription}: the subscription keeps no plaintext signing secret, so the event cannot be signed for it. Observed: subscription {subscription}. Fix: create the subscription again ('DELETE /v3/webhook-subscriptions/{subscription}', then 'POST /v3/webhook-subscriptions') so it keeps its signing secret. Provoked by `tests/telegram/send-and-receive.mjs::an_unsigned_subscription_is_logged`.
  • `most.telegram.receive.event-kept` — HTTP 503, exit 69, and sending it again can help. sending Telegram message {message} to {target}: the subscriber did not accept the event, so it is kept in the webhook outbox. Observed: {target}: {error}. Fix: repair the subscriber, then 'most-cli webhook-outbox redeliver' sends it again. Provoked by `tests/telegram/send-and-receive.mjs::an_event_the_subscriber_refuses_is_kept`.