{"record":{"id":"a4d6723e49de7f00","repo":"diegosouzapw/OmniRoute","slug":"telegram-api-method-failed-json-description","errorCode":null,"errorMessage":"Telegram API ${method} failed: ${json?.description || res.status}","messagePattern":"Telegram API (.+?) failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/lib/telegram/botApi.ts","lineNumber":68,"sourceCode":"}\n\nasync function botFetch<T>(method: string, body: unknown): Promise<T> {\n  const token = getTelegramBotToken();\n  if (!token) throw new Error(\"TELEGRAM_BOT_TOKEN is not set\");\n  const url = `${getTelegramBotApiBase()}/bot${token}/${method}`;\n  const res = await fetch(url, {\n    method: \"POST\",\n    headers: { \"Content-Type\": \"application/json\" },\n    body: JSON.stringify(body),\n    signal: AbortSignal.timeout(getTelegramWebhookTimeoutMs()),\n  });\n  const json = (await res.json().catch(() => null)) as {\n    ok?: boolean;\n    description?: string;\n    result?: T;\n  } | null;\n  if (!res.ok || !json?.ok) {\n    throw new Error(`Telegram API ${method} failed: ${json?.description || res.status}`);\n  }\n  return json.result as T;\n}\n\nexport async function sendTelegramMessage(\n  params: TelegramSendMessageParams\n): Promise<TelegramMessage> {\n  return botFetch<TelegramMessage>(\"sendMessage\", params);\n}\n\nexport async function editTelegramMessage(\n  params: TelegramEditMessageParams\n): Promise<TelegramMessage> {\n  return botFetch<TelegramMessage>(\"editMessageText\", params);\n}\n\n/**\n * Register (or unregister) the bot webhook. Returns the Bot API result.","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/lib/telegram/botApi.ts#L50-L86","documentation":"Error \"Telegram API ${method} failed: ${json?.description || res.status}\" thrown in diegosouzapw/OmniRoute.","triggerScenarios":"Thrown at src/lib/telegram/botApi.ts:68 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","schemaVersion":2},"datasetVersion":"2026-08-25T21:54:21.419Z"}