diegosouzapw/OmniRoute · error
TELEGRAM_BOT_TOKEN is not set
Error message
TELEGRAM_BOT_TOKEN is not set
What it means
Configuration sentinel in botFetch: getTelegramBotToken() returned empty — the TELEGRAM_BOT_TOKEN env var (or override) is unset. Every Telegram Bot API call needs the token to build the /bot<token>/<method> URL, so any bot method fails immediately until the token is configured.
Solutions
- Set TELEGRAM_BOT_TOKEN (from @BotFather) in the environment and restart
- Verify the env var is actually loaded by the process (not just the shell)
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at src/lib/telegram/botApi.ts:54 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25).
Data as JSON: /api/errors/9d3a7b2a5daab4c0.
Report an issue: GitHub.
Appendix: source
Thrown at src/lib/telegram/botApi.ts:54
from?: TelegramUser;
}
export interface TelegramUpdate {
update_id: number;
message?: TelegramMessage;
// Mini App payloads arrive as callback_query or message.web_app_data;
// the common shape is message.text (commands) — start with those.
callback_query?: {
id: string;
from: TelegramUser;
message?: TelegramMessage;
data?: string;
};
}
async function botFetch<T>(method: string, body: unknown): Promise<T> {
const token = getTelegramBotToken();
if (!token) throw new Error("TELEGRAM_BOT_TOKEN is not set");
const url = `${getTelegramBotApiBase()}/bot${token}/${method}`;
const res = await fetch(url, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(body),
signal: AbortSignal.timeout(getTelegramWebhookTimeoutMs()),
});
const json = (await res.json().catch(() => null)) as {
ok?: boolean;
description?: string;
result?: T;
} | null;
if (!res.ok || !json?.ok) {
throw new Error(`Telegram API ${method} failed: ${json?.description || res.status}`);
}
return json.result as T;
}
View on GitHub (pinned to a179ffed5b)