Telegram plugin (0.0.1) crashes on network interruption

Resolved 💬 3 comments Opened Mar 21, 2026 by bot-rogerthat Closed Mar 21, 2026

Description

The Telegram channel plugin (claude-channel-telegram@0.0.1) crashes silently on any network interruption (VPN reconnect, Wi-Fi switch, brief connectivity loss). Once crashed, the MCP server disconnects and cannot be restored without restarting Claude Code.

Root Cause

In server.ts (line 594), bot.start() is called fire-and-forget with no error handling:

void bot.start({
  onStart: info => {
    botUsername = info.username
    process.stderr.write(`telegram channel: polling as @${info.username}\n`)
  },
})

Missing:

  1. No bot.catch() middleware — grammY throws unhandled errors on polling failures (ETIMEOUT, ECONNRESET), which crash the process
  2. No reconnection logic — once the polling loop dies, the bot never reconnects
  3. No process.on('uncaughtException'/'unhandledRejection') handlers — any unhandled error kills the MCP server process

Steps to Reproduce

  1. Start Claude Code with the Telegram plugin active
  2. Disconnect/reconnect VPN or switch Wi-Fi networks
  3. Telegram MCP server disconnects within seconds
  4. Tools (reply, react, edit_message) become unavailable
  5. Only fix is restarting Claude Code

Expected Behavior

The plugin should survive transient network issues and automatically reconnect polling to the Telegram Bot API.

Suggested Fix

bot.catch((err) => {
  process.stderr.write(`telegram channel: bot error: ${err.message}\n`)
})

void bot.start({
  onStart: info => {
    botUsername = info.username
    process.stderr.write(`telegram channel: polling as @${info.username}\n`)
  },
}).catch(err => {
  process.stderr.write(`telegram channel: polling died, restarting: ${err.message}\n`)
  // reconnect logic here
})

Environment

  • Claude Code v2.1.80
  • Plugin: claude-channel-telegram@0.0.1
  • OS: macOS (darwin/arm64)
  • Network: corporate VPN (NetBird) with periodic reconnects

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗